Whole numbers are great, but I think we should also pay attention to decimal numbers, too.
So, how about we make a program that involves a lot of decimals?
Instructions:
#include <bits/stdc++.h>
using namespace std;
int main()
{
float num, sum = 0.0;
do
{
cout<<"Enter the Decimal Number: ";
cin>>num;
sum += num;
}
while ((num > 0) and (sum < 100.0));
cout<<"Total Sum is: "<<sum<<endl;
}
Comments
Leave a comment