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

C statement to copy a string without using loop and library function..

2 Answers   Persistent, TCS,


void main() { int *mptr, *cptr; mptr = (int*)malloc(sizeof(int)); printf(“%d”,*mptr); int *cptr = (int*)calloc(sizeof(int),1); printf(“%d”,*cptr); }

1 Answers  


Find your day from your DOB?

15 Answers   Accenture, Microsoft,


union u { struct st { int i : 4; int j : 4; int k : 4; int l; }st; int i; }u; main() { u.i = 100; printf("%d, %d, %d",u.i, u.st.i, u.st.l); } a. 4, 4, 0 b. 0, 0, 0 c. 100, 4, 0 d. 40, 4, 0

1 Answers   HCL,


#include<stdio.h> main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p + ++*str1-32); }

1 Answers  






how to check whether a linked list is circular.

11 Answers   Microsoft,


main() { char a[4]="HELL"; printf("%s",a); }

3 Answers   Wipro,


main() { int i=0; for(;i++;printf("%d",i)) ; printf("%d",i); }

1 Answers   Zoho,


void main() { int i=10, j=2; int *ip= &i, *jp = &j; int k = *ip/*jp; printf(“%d”,k); }

1 Answers  


#include <stdio.h> #define a 10 main() { #define a 50 printf("%d",a); }

2 Answers  


write a program to count the number the same (letter/character foreg: 's') in a given sentence.

2 Answers  


How to return multiple values from a function?

7 Answers  


Categories