Write an algorithm to accept two numbers,compute the sum and print the result
Answers
Answered by
0
Hello !!
In C language.
#include <stdio.h>
#include <math.h>
#include <conio.h>
#include <stdlib.h>
float main()
{
float sum, number1, number2;
printf("Put the first number:");
scanf("%f",&number1);
printf("Put the second number:");
scanf("%f",&number2);
sum = number1 + number2;
printf("The result is:%0.5f",sum);
return(0);
}
In pascal language.
var
sum, number1, number2 : real;
begin
writeln('Put the first number:');
readln(number1);
writeln('Put the second number:');
readln(number2);
sum:= number1 + number2;
writeln('The result of the sum is :',sum);
end.
Note : see the result of the compilation in the picture.
I hope I have collaborated !
Attachments:
Similar questions
World Languages,
5 months ago
English,
5 months ago
Chemistry,
11 months ago
Math,
11 months ago
Math,
1 year ago