Thursday, January 28, 2016

Write a program and algorithm to calculate addition of two numbers.

OBJECT: - Write a program and algorithm to calculate addition of two numbers.

Algorithm:-
Step (1):- Start
Step (2):- Declare integer type of variable
Step (3):- Input value a & b
Step (4):- sum ← a + b
Step (5):- output
Step (6):- Stop the execution

Program:- 

# include<stdio.h>
#include<conio.h>
void main()
{
int a,b,sum;
clrscr();
printf("Input the  value of a & b:");
scanf("%d%d", &a,&b);
sum= a+b;
printf("%d",sum);
getch();
}

------------------------------------------------------------------------------------

Output:-

Input the value of a & b: 5
3
8

0 Comments:

Post a Comment