Docsity

Quadratic equation problem using c++, Study notes of Computer Programming

Toggle sidebar
bg1
TEST: 01
Q# 01: Write a program which accepts amount as integer and display total number
of Notes of Rs. 500, 100, 50, 20, 10, 5 and 1.
For example, when user enter a number, 575,
the results would be like this...
500: 1
100: 0
50: 1
20: 1
10: 0
5: 1
1: 0
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int a,b,c,d,e,f,g,h,i,j,k,l,m,n;
cout<<"enter the amount = ";
cin>>a;
b=a/500;
cout<<"the number of 500 notes is = "<<b<<endl;
c=a%500;
d=c/100;
cout<<"the number of 100 notes is = "<<d<<endl;
e=c%100;
f=e/50;
cout<<"the number of 50 notes is = "<<f<<endl;
g=e%50;
pf3
pf4

Partial preview of the text

Download Quadratic equation problem using c++ and more Study notes Computer Programming in PDF only on Docsity!

TEST: 01

Q# 01: Write a program which accepts amount as integer and display total number of Notes of Rs. 500, 100, 50, 20, 10, 5 and 1. For example, when user enter a number, 575, the results would be like this... 500: 1 100: 0 50: 1 20: 1 10: 0 5: 1 1: 0 #include #include using namespace std; int main() { int a,b,c,d,e,f,g,h,i,j,k,l,m,n; cout<<"enter the amount = "; cin>>a; b=a/500; cout<<"the number of 500 notes is = "<<b<<endl; c=a%500; d=c/100; cout<<"the number of 100 notes is = "<<d<<endl; e=c%100; f=e/50; cout<<"the number of 50 notes is = "<<f<<endl; g=e%50;

h=g/20; cout<<"the number of 20 notes is = "<<h<<endl; i=g%20; j=i/10; cout<<"the number of 10 notes is = "<<j<<endl; k=i%10; l=k/5; cout<<"the number of 5 rs. coins is = "<<l<<endl; m=k%5; n=m/1; cout<<"the number of 1 rs. coins is = "<<n<<endl; return 0; }

c=5;

x=a-- + b++ - ++c;

cout<<” x= ”<<x;