Print sum of 3 float numbers in C++
cout - Question 7
In this question, we will see how to print the sum of 3 float numbers in C++ programming using the cout statement. To know more about cout statement click on the cout statement 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 <iostream>
#include <conio.h>
using namespace std;
int main()
{
float a=4.5, b=9.0, c=8.63;
cout<<"Sum="<<a+b+c;
return 0;
}
Output
Sum=22.13