C program to add two numbers :
#include< stdio.h >
#include< conio.h >
void main()
{
int num1,num2;
void add (int a, int b);
clrscr();
printf("Enter two numbers:");
scanf("%d %d",&num1,&num2);
add(num1,num2);
getch();
}
void add (int a, int b)
{
int c;
c=a+b;
printf("Sum of given numbers is=%d",c);
}
OUTPUT :
Enter two numbers:
5
8
Sum of given numbers=13
#include< stdio.h >
#include< conio.h >
void main()
{
int num1,num2;
void add (int a, int b);
clrscr();
printf("Enter two numbers:");
scanf("%d %d",&num1,&num2);
add(num1,num2);
getch();
}
void add (int a, int b)
{
int c;
c=a+b;
printf("Sum of given numbers is=%d",c);
}
OUTPUT :
Enter two numbers:
5
8
Sum of given numbers=13
No comments :
Post a Comment