Dremendo Tag Line

Print sum of 3 float numbers in C

printf() - Question 7

In this question, we will see how to print the sum of 3 float numbers in C programming using the printf() function. To know more about printf() function click on the printf() function lesson.

Q7) Write a program in C to print the sum of 3 float numbers like float a=4.5, b=9.0, c=8.63.

Program

#include <stdio.h>
#include <conio.h>

int main()
{
    float a=4.5, b=9.0, c=8.63;
    printf("Sum=%f",a+b+c);
    return 0;
}

Output

Sum=22.130000
video-poster