Write a C Program accept two nos from user make addition of them and display result

Source Code

#include <stdio.h>
#include <conio.h>
void main( )
{
    int num1, num2, add;
    printf("Enter two integers: \n");
    scanf("%d %d",&num1,&num2); /* Stores the two integer entered by user in variable num1 and num2 */

    add=num1+num2;      /* Performs addition and stores it in variable add */
    printf("Addition = %d",add);  /* Displays addition */
    getch();
}


Output

Enter two integers: 5 7
Addition = 12

Download

No comments:

Post a Comment