11/02/2019

Sum of two Real numbers in C-programming:

Sum of two Real numbers in C-programming: 

We are going to do sum of two real numbers in C-programming. Here you can use any C-programming software to do it. At first we give the code of this programming and then we explain it smoothly. We always try to make easy for the beginners.

                                                                                                                                                                        The code of this programme is below:                                                                   
#include<stdio.h>
#include<conio.h>
void main()
{
float a,b,add;
printf("Enter two numbers:\n");
scanf("%f%f",&a,&b);
add=a+b;
printf("the sum of %f and %f is %f",a,b,add);
getch();
}
If you run the above program then you get this output below:




EXPLANATION:

1. First of all we used two packages <stdio.h> and <conio.h>. to know the uses of <stdio.h> and <conio.h> visit our packages page.
2. we used "void main()" here you can use only "main()" if you use windows operating system or you can use "int main()" if you use Linux operating system.
know more in important syntax of our page.
3. we used three float variable a,b,add.
4. Now we use "a" and "b" for store the two given numbers and use "add" variable to give the addition value of "a" and "b".
5. Now we print the value of "add" variable and we get the output.
6. Now we use "getch()". To know more go to important syntax

No comments:

Post a Comment