Write a C program to add two numbers before the main function
is called.

Answers were Sorted based on User's Feedback



Write a C program to add two numbers before the main function is called...

Answer / deepjot kaur

void AddTwoNumbers();
#pragma startup AddTwoNumbers

void main()
{
printf("\n Executing Main...");
}


void AddTwoNumbers()
{
int num1,num2 = 0;
printf( "\nEnter number 1 : ");
scanf( "%d", &num1 );

printf( "\nEnter number 2 : ");
scanf( "%d", &num2 );

printf( "\nThe sum is = %d..." ,(num1 + num2) );
}

Is This Answer Correct ?    45 Yes 29 No

Write a C program to add two numbers before the main function is called...

Answer / boss

Answer#1 above by Deepjot Kaur is the ONLY CORRECT ANSWER
Here. Pls ignore all others. They Posters did not understood
the Question basically.

The Qn is: We need to write a program in which there is one
main and a function. When executed, Function should run
first and then the Main().

Is This Answer Correct ?    10 Yes 3 No

Write a C program to add two numbers before the main function is called...

Answer / sheenu

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("enter the value");
scanf("%d%d",&a,&b);
c=a+b;
printf("%d",c);
getch();
}

Is This Answer Correct ?    8 Yes 5 No

Write a C program to add two numbers before the main function is called...

Answer / govind verma

but #prgma does not support on gcc... so this code is run only turbo c ......

Is This Answer Correct ?    3 Yes 0 No

Write a C program to add two numbers before the main function is called...

Answer / naveen

#include <stdio.h>
#include <conio.h>
void main();
{

int a,b,c;
scanf("%d%d", &a,&b);
printf("enter a two numbers \n");
c=a+b;
printf("The add of two numbers are %d ",c);
clrscr();
getch();
}

Is This Answer Correct ?    6 Yes 5 No

Write a C program to add two numbers before the main function is called...

Answer / salini

#include<stdio.h>
void main()
{
int a,b,c;
printf("Enter the first number :");
scanf("%d \n",&a);
printf("Enter the second number :");
scanf("%d \n",&b);
c=a+b;
printf("The addition of %d and %d is %d",&a,&b,&c);
}

Is This Answer Correct ?    3 Yes 5 No

Write a C program to add two numbers before the main function is called...

Answer / pavan mustyala

#include <stdio.h>

int func()
{
int a = 10;
int b = 20;
printf("\nExecuting func FIRST...\n");

printf("Sum of the two numbers is %d", (a + b));
return (a + b);
}

int x = func();

int main(int argc, char* argv[])
{
printf("\nExecuting Main LAST...\n");
return 0;
}

Is This Answer Correct ?    12 Yes 15 No

Write a C program to add two numbers before the main function is called...

Answer / nirmal bhattarai

#include<stdio.h>
#include<conio.h>
void main()
{
rintf("\n Executing Main...");
}


void AddTwoNumbers()
{
int num1,num2 = 0;
printf( "\nEnter number 1 : ");
scanf( "%d", &num1 );

printf( "\nEnter number 2 : ");
scanf( "%d", &num2 );

printf( "\nThe sum is = %d..." ,(num1 + num2) );
}
get();
}

Is This Answer Correct ?    1 Yes 4 No

Write a C program to add two numbers before the main function is called...

Answer / b.vinod

#include<stdio.h>
main()
{
int a,b,c;
printf("Enter the value a,b");
scanf("%d%d",&a,&b);
c=a+b;
printf("c value is%d",a);
}

Is This Answer Correct ?    11 Yes 27 No

Write a C program to add two numbers before the main function is called...

Answer / divya prabhu

#include<stdio.h>
#include<conio.h>

void add()
{
int a,b,c;
printf("\n Enter the two numbers to be added:");
scanf("%d %d",&a,&b);
c=a+b;
printf("\n The addition of two entered numbers is: %
d",c);
}


void main()
{
clrscr();
add();
getch();
}

Is This Answer Correct ?    12 Yes 31 No

Post New Answer

More C Code Interview Questions

main() { int x=5; clrscr(); for(;x<= 0;x--) { printf("x=%d ", x--); } } a. 5, 3, 1 b. 5, 2, 1, c. 5, 3, 1, -1, 3 d. –3, -1, 1, 3, 5

2 Answers   HCL,


Which one is taking more time and why ? :/home/amaresh/Testing# cat time.c //#include <stdio.h> #define EOF -1 int main() { register int c; while ((c = getchar()) != EOF) { putchar(c); } return 0; } ------------------- WIth stdio.h:- :/home/amaresh/Testing# time ./time_header hi hi hru? hru? real 0 m4.202s user 0 m0.000s sys 0 m0.004s ------------------ Witout stdio.h and with #define EOF -1 =================== /home/amaresh/Testing# time ./time_EOF hi hi hru? hru? real 0 m4.805s user 0 m0.004s sys 0 m0.004s -- From above two case , why 2nd case is taking more time ?

0 Answers  


how to test pierrot divisor

0 Answers  


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']

0 Answers  


void main() { static int i=5; if(--i){ main(); printf("%d ",i); } }

1 Answers  






There is a lucky draw held every day. if there is a winning number eg 1876,then all possible numbers like 1867,1687,1768 etc are the numbers that match irrespective of the position of the digit. Thus all these numbers qualify fr the lucky draw prize Assume there is no zero digit in any numbers. write a program to show all the possible winning numbers if a "winning number"is passed as an arguments to the function.

1 Answers   Nagarro,


main() { int i=_l_abc(10); printf("%d\n",--i); } int _l_abc(int i) { return(i++); }

2 Answers  


/*what is the output for*/ void main() { int r; printf("Naveen"); r=printf(); getch(); }

4 Answers  


why is printf("%d %d %d",i++,--i,i--);

4 Answers   Apple, Cynity, TCS,


program to Reverse a linked list

12 Answers   Aricent, Microsoft, Ness Technologies,


Write a C program to add two numbers before the main function is called.

11 Answers   Infotech, TC,


#define FALSE -1 #define TRUE 1 #define NULL 0 main() { if(NULL) puts("NULL"); else if(FALSE) puts("TRUE"); else puts("FALSE"); }

1 Answers  


Categories