How to add two numbers with using function?

Answer Posted / balaji

/*this program is used to add two numbers using functions */
#include<stdio.h>
#include<conio.h>
void add(int,int);
void main()
{
int x,y;
printf("enter the two digits/numbers which you want to add");
scanf("%d%d",&x,&y);
add(x,y);
getch();
}
void add(int a,int b)
{
int c;
c=a+b;
printf("the sum of %d and %d is %d",a,b,c);
}

Is This Answer Correct ?    5 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is && in c programming?

919


What does printf does?

1002


how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions

2976


write a program to display all prime numbers

1703


Define VARIABLE?

924


What is the purpose of sprintf?

831


When can a far pointer be used?

789


Can you please explain the difference between malloc() and calloc() function?

879


What is the general form of a C program?

802


How can I split up a string into whitespace-separated fields?

829


What are the features of the c language?

871


Is c programming hard?

787


Write a program to print factorial of given number without using recursion?

791


Can you add pointers together? Why would you?

901


please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code

1939