0
An ATM gives money in denominations of 2000,500, 200, 100 & 50/- . Given an amount as input, print how many notes of each denomi
An ATM gives money in denominations of 2000,500, 200, 100 & 50/- . Given an amount as input, print how many notes of each denomination will be released. this program will work only for amounts entered in multiples of 50. input : 22350 output : 2000/- notes: 11 500/- notes: 0 200/- notes: 1 100/- notes: 1 50/- notes: 1....,.using data types ,..operators
10 Respuestas
+ 2
Please use a programming language name in tags instead of those random words.
Also can show us the code you have written so far ?
+ 2
jayadurga Nagisetty yes so ?
Operators are "/", "+", "%" And data type can be a integer , float or double . You might know all that and so, can you write a code and show us so that we can help you further.
0
Write a function to find difference between smallest and biggest prime number in a givem range
0
#include <bits/stdc++.h>
using namespace std;
void countCurrency(int amount)
{
int notes[9] = { 2000, 500, 200, 100,
50, 20, 10, 5, 1 };
int noteCounter[9] = { 0 };
for (int i = 0; i < 9; i++) {
if (amount >= notes[i]) {
noteCounter[i] = amount / notes[i];
amount = amount % notes[i];
}
}
cout << "Currency Count ->" << endl;
for (int i = 0; i < 9; i++) {
if (noteCounter[i] != 0) {
cout << notes[i] << " : "
<< noteCounter[i] << endl;
cout<<notes[i]+notes[i+1];
}
}
}
int main()
{
int amount = 868;
countCurrency(amount);
return 0;
}
0
notes= (1000, 500, 100, 50, 20, 5, 1)
amount = int(input('rupees:='))
output = {}
for n in notes:
output[n] = amount // n
amount %= n
for x,y in output.items():
print(x, y, sep=':')
0
An ATM gives money in denominations of 10, 100 & 50/- . Given an amount as input, print how many notes of each denomination will be released. this program will work only for amounts entered in multiples of 10 and 100.
- 1
C program...using only operators and data types
- 1
#include<studio.h>
Int main()
{
int amount;
int note2000, note5000, note200,note100,note50;
/* Initialize all notes to 0 */
note2000 = note500 = note200 = note100 = note50 = 0;
/* Input amount from user */
printf("Enter amount: ");
scanf("%d", &amount);
if(amount >= 2000)
{
note2000 = amount/2000;
amount -= note2000 * 2000;
}
if(amount >= 500)
{
note500 = amount/500;
amount -= note500 * 500;
}
if(amount >= 200)
{
note200 = amount/200;
amount -= note200 * 200;
}
if(amount >= 100)
{
note100 = amount/100;
amount -= note100 * 100;
}
if(amount >= 50)
{
note50 = amount/50;
amount -= note50 * 50;
}
return 0;
}
- 1
#include<stdio.h>
int main()
{
int A,B,C,D,E=0;
int amount=0;
printf("enter amount:");
scanf("%d",&amount);
A=amount/2000;
amount-=A*2000;
B=amount/500;
amount-=B*500;
C=amount/200;
amount-=C*200;
D=amount/100;
amount-=D*100;
E=amount/50;
printf("2000notes=%d\n500notes=%d\n200notes=%d\n100notes=%d\n50notes=%d",A,B,C,D,E);
}
- 3
Int a,b,c,d
Printf("enter amount")
Scanf(",%d",&a)
A=22000/2000
B=200/200
C=100/100
D=50/50
Printf("2000notes=%d/n200notes=%d/n100notes=%d/n50notes=%d. is it working .... without conditions