Powered By Blogger

Friday, December 24, 2010

C Program to find the sum of 2 numbers

/* C Program to accept 2 numbers from the user and to display their sum */

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int num1;
    int num2;
    int sum;
    printf("Enter the First number\n");
    scanf("%d",&num1);
    printf("Enter the Second number\n");
    scanf("%d",&num2);
    sum=num1+num2;
    printf("The sum of %d and %d is %d\n",num1,num2,sum);
    return 0;
}

No comments:

Post a Comment