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 / jhansi rani attuluri

#include<stdio.h>
int sum(int a,int b);
int sum(int a,int b)
{

return a+b;
}
main()
{
int a,b,c;
printf("enter the value for a,b:");
scanf("%d %d",&a,&b);
printf("sum is %d\n",sum(a,b));
}

Is This Answer Correct ?    19 Yes 45 No

Post New Answer

More C Code Interview Questions

Given a list of numbers ( fixed list) Now given any other list, how can you efficiently find out if there is any element in the second list that is an element of the first list (fixed list)

3 Answers   Disney, Google, ZS Associates,


main() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a. Runtime error. b. I am OK c. Compile error d. I am O

4 Answers   HCL,


Which version do you prefer of the following two, 1) printf(“%s”,str); // or the more curt one 2) printf(str);

1 Answers  


Write a C function to search a number in the given list of numbers. donot use printf and scanf

5 Answers   Honeywell, TCS,


main() { int a=10,*j; void *k; j=k=&a; j++; k++; printf("\n %u %u ",j,k); }

1 Answers  






main() { extern int i; i=20; printf("%d",i); }

1 Answers   Value Labs,


To reverse an entire text file into another text file.... get d file names in cmd line

0 Answers   Subex,


main( ) { int a[ ] = {10,20,30,40,50},j,*p; for(j=0; j<5; j++) { printf(“%d” ,*a); a++; } p = a; for(j=0; j<5; j++) { printf(“%d ” ,*p); p++; } }

1 Answers  


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

0 Answers  


main() { int i; clrscr(); printf("%d", &i)+1; scanf("%d", i)-1; } a. Runtime error. b. Runtime error. Access violation. c. Compile error. Illegal syntax d. None of the above

1 Answers   HCL,


main() { main(); }

1 Answers  


What is "far" and "near" pointers in "c"...?

3 Answers  


Categories