Computer Science, asked by nbhargavramnavuluri6, 11 months ago

Dollars & Cents
Write a C++ program to add two dollars and cents.
INPUT & OUTPUT FORMAT:

Input consists of 4 integers. First two inputs correspond to the value of the first dollar and cent. Next two inputs correspond to the value of the second dollar and cent. Output should print the sum of dollar and cent.

SAMPLE INPUT:

30

10

140

99

SAMPLE OUTPUT:

171

9

Case 1
Case 2
Case 3
Input (stdin)
30
10
140
99

Output (stdout)
171
9

Answers

Answered by jjzach21
1

Answer:

C++

Explanation:

#include<iostream>

#include <iomanip>  

using namespace std;

int main()

{

 int a,b,c,d;

 float x,y,z,o;

 cin>>a>>b>>c>>d;

 do

 {

   x= (a+c);

  y= (b*.01)+(d*.01);

   z=x+y;

   cout<<(int)z<<"\n";

  o=(z-(int)z)*100;

   

   cout<<fixed<<setprecision(0)<<o;

   

 }while(a<0);

 return 0;

}

Similar questions