With basic knowledge on input-output function of C. We can now perform simple arithmetic programs, like in this example Addition Program.
Source Code:
#include<stdio.h>
main()
{
int num1, num2, sum;
clrscr();
printf("Enter two numbers to perform Addition:");
scanf("%d %d", &num1, &num2);
sum=num1+num2;
printf("The sum of two numbers is: %d",sum);
getch();
}
Output of the Program:
Source Code:
#include<stdio.h>
main()
{
int num1, num2, sum;
clrscr();
printf("Enter two numbers to perform Addition:");
scanf("%d %d", &num1, &num2);
sum=num1+num2;
printf("The sum of two numbers is: %d",sum);
getch();
}
Output of the Program:
0 comments :
Post a Comment