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 the purpose of sprintf() function?

813


write a c program in such a way that if we enter the today date the output should be next day's date.

1908


What is nested structure with example?

822


What is keyword in c?

791


Explain what are the different data types in c?

950


a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor

846


i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical

2082


define string ?

860


Is c procedural or functional?

789


What are the advantages and disadvantages of a heap?

922


Implement bit Array in C.

885


How is a macro different from a function?

868


a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler

853


When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?

1031


Can we use visual studio for c?

774