C program for addition of Two Integer values

num1 and num2 are two integer variables and performed sum using + operator.

#include<stdio.h>
int main()
{
    int num1,num2,sum;
    printf("Enter two numbers to Perform Addition:");
    scanf("%d %d",&num1,&num2);

    sum=num1+num2; //integer sum

    printf("the sum of %d and %d is %d",num1,num2,sum);
    return 0;
}

 Output for integer sum:

Enter two numbers to Perform Addition:10
20
the sum of 10 and 20 is 30

C program for addition of Two floating point values

num1 and num2 are two floating point variables and performed sum using + operator.

#include<stdio.h>
int main()
{
    float num1,num2,sum;
    printf("Enter two float numbers to Perform Addition:");
    scanf("%f %f",&num1,&num2);

    sum=num1+num2; //floating point sum

    printf("the sum of %f and %f is %f",num1,num2,sum);
    return 0;
}

Output for float sum:

Enter two float numbers to Perform Addition:2.35
3.645
the sum of 2.350000 and 3.645000 is 5.995000