C program to add two numbers :

#include< stdio.h >
#include< conio.h >
void main()
{
          int num1,num2,S;
          int add (int a, int b);
          clrscr();
          printf("Enter two numbers:");
          scanf("\n%d\n %d",&num1,&num2);
          S=add(num1,num2);
          printf("Sum of given numbers=%d",S);
         getch();
}
int add (int a, int b)
{
         int c;
        c=a+b;
       return c;
}

OUTPUT :

Enter two numbers:
5
8
Sum of given numbers=13

No comments :

Post a Comment