Write a C++ program that adds two floating point numbers and shows the sum on the screen.

 




#include<iostream>

using namespace std;

int main()

{

float var1, var2, res;

var1 = 24.37;

var2 = 41.50;

res = var1 + var2;

cout<<var1<<" + "<<var2<<" = "<<res;

}

OUTPUT

24.37 + 41.5 = 65.87

1 comment: