Sum of two number(integers) in C: We use C-programming to add two numbers (integers). We use Borland C++ to compile the programming code.
At first we write the code and then we discuss how it will work then we will upload the picture of outcome results of this programming.
The code is --
#include<stdio.h> #include<conio.h>
void main()
{
int a,b,add;
printf("Enter the two number:\n");
scanf("%d%d",&a,&b);
add=a+b;
printf("the sum of of %d and %d is %d",a,b,add);
getch();
}
here we use a package stdio.h to run the C- program here i use three integers variable 'a' ,'b' and 'add' . At first we use 'a' and 'b' to store two given number(integer) and after saving this two numbers we add this and save the number in variable 'add' and after saving the value of add we printed it. We use getch() command to stable the output window. If you use Linux operating system then you have not use the command getch().
here we use a package stdio.h to run the C- program here i use three integers variable 'a' ,'b' and 'add' . At first we use 'a' and 'b' to store two given number(integer) and after saving this two numbers we add this and save the number in variable 'add' and after saving the value of add we printed it. We use getch() command to stable the output window. If you use Linux operating system then you have not use the command getch().
The output result of this C-programming is in below the video:
No comments:
Post a Comment