How to add two numbers with using function?

Answers were Sorted based on User's Feedback



How to add two numbers with using function? ..

Answer / geetha

#include<stdio.h>
#include<conio.h>
int add(int,int);
main()
{
int a,b,c;
printf("enter a,b values");
scanf("%d%d",&a,&b);
c=add(a,b);
printf("%d",c);
}
int add(int x,int y)
{
return(x+y);
}

Is This Answer Correct ?    9 Yes 0 No

How to add two numbers with using function? ..

Answer / vinay kumar

suppose x=5 and y=10,Then
while(y!=0)
{
x++;
y--;
}
printf("the sum value is:%d
",x);

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

What does a derived class inherit from a base class a) Only the Public members of the base class b) Only the Protected members of the base class c) Both the Public and the Protected members of the base class d) .c file

0 Answers  


Are there any problems with performing mathematical operations on different variable types?

0 Answers  


What will be the output of x++ + ++x?

20 Answers   MBT, Religare,


What is character constants?

0 Answers  


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

0 Answers   Lovely Professional University,






identify the in correct expression a.a=b=3=4; b.a=b=c=d=0; float a=int b=3.5; d.int a; float b; a=b=3.5;

8 Answers   TCS,


which is conditional construct a) if statement b) switch statement c) while/for d) goto

0 Answers  


What is modifier & how many types of modifiers available in c?

0 Answers  


void main() { int a=1; while(a++<=1) while(a++<=2); }

4 Answers   HCL,


Give me the code of in-order recursive and non-recursive.

0 Answers   DELL,


Explain what are multidimensional arrays?

0 Answers  


what is the similarities between. system call and library function?

1 Answers   Wipro,


Categories