C Program to Add Two Integers and Floats

9

In this c program, we enter two integer number and two float number that displays the sum of two integer numbers and two float numbers.

Flowchart to Add Two Integers and Floats

Flowchart to Add Two Integers and Floats
Flowchart to Add Two Integers and Floats
#include <stdio.h>

int main() {
    int no1, no2, integer_sum;
    float no3, no4, float_sum;

    printf("Enter No1: ");
    scanf("%d", &no1);
    printf("Enter No1: ");
    scanf("%d", &no2);


    integer_sum = no1 + no2;


    printf("%d + %d = %d", no1, no2, integer_sum);

    printf("\nEnter Float No3: ");
    scanf("%f", &no3);
    printf("Enter Float No4: ");
    scanf("%f", &no4);


    float_sum = no3 + no4;


    printf("%f + %f = %f", no3, no4, float_sum);

    return 0;
}

Output

Enter No1: 5
Enter No1: 10
5 + 10 = 15
Enter Float No3: 10.5
Enter Float No4: 5.7
10.500000 + 5.700000 = 16.200001

Get real time updates directly on you device, subscribe now.

Subscribe to our newsletter
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time
You might also like