How to add two numbers with using function?

Answer Posted / anandi

#include<stdio.h>
#include<conio.h>
void main()
{
int add(int,int);
int a,b;
clrscr();
printf("Enter two numbers: ");
scanf("%d %d",&a,&b);
printf("The Sum is: %d",add(a,b));
getch();
}
int add(int x,int y)
{
return(x+y);
}

Is This Answer Correct ?    42 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different types of control structures?

577


Write a program which returns the first non repetitive character in the string?

595


What are the types of pointers in c?

526


how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?

1503


any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above

639






WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER

1455


What is c programing language?

610


Function calling procedures? and their differences? Why should one go for Call by Reference?

629


Is c is a high level language?

612


What is dynamic memory allocation?

802


What is c language and why we use it?

612


How to get string length of given string in c?

601


Does c have class?

608


Is main a keyword in c?

623


Can we declare function inside main?

560