Completely Solved C, C++ Programs Assignment.




C Program to accept two numbers and print sum of two numbers by using functions

Filed Under:

Problem 35. C Program to accept two numbers and print sum of two numbers by using functions
#include<stdio.h>
#include<conio.h>
main( )
{
int a,b,c;
clrscr();
printf(“enter the value for a:”)
scanf(“%d”,&a);
printf(“enter the value for b:”)
scanf(“%d”,&b);
c=add(a,b);
printf(“sum of two numbers is %d”,c);
getch( );
}
int add(int x, int y)
{
int z;
z=x+y;
return z;
}

C compiler: gcc 4.1.2

  Back to main directory: Sample C Program | Software Practical | Solved C Assignment


Get Free Programming Tutorials and Solved assignments