Input 2 decimal numbers and find the floor value of their sum using mathematical functions in C++
Mathematical Functions - Question 4
In this question, we will see how to input 2 decimal numbers and find the floor value of the sum of the numbers in C++ programming using the mathematical functions. To know more about mathematical functions click on the mathematical functions lesson.
Q4) Write a program in C++ to input 2 decimal numbers and find the floor value of the sum of the numbers.
Program
#include <iostream>
#include <conio.h>
#include <cmath>
using namespace std;
int main()
{
float a,b,s;
int x;
cout<<"Enter 2 decimal numbers\n";
cin>>a>>b;
s=a+b;
x=floor(s);
cout<<"Floor value of sum = "<<x;
return 0;
}
Output
Enter 2 decimal numbers 12.36 8.47 Floor value of sum = 20