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 bit rate & baud rate? plz give wave forms

1512


What is 2 d array in c?

547


Synonymous with pointer array a) character array b) ragged array c) multiple array d) none

611


What is a const pointer in c?

666


Explain the use of 'auto' keyword in c programming?

677






When should a type cast not be used?

620


How can you restore a redirected standard stream?

606


What is a structure in c language. how to initialise a structure in c?

603


What are structures and unions? State differencves between them.

605


Write a program to print fibonacci series using recursion?

581


What are the different types of endless loops?

615


Explain what is the benefit of using an enum rather than a #define constant?

713


Define C in your own Language.

633


Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

663


is it possible to create your own header files?

631