The question is given in description | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

The question is given in description

You have a certain number of 100 rupee notes, 10 rupee notes and 1 rupee notes with you. There is an item you want to buy whose price is given to you. Write a program to find if the item is affordable, that is the price of the item is less than or equal to the current money you have. Input ----- Four non negative integers. The first input is an integer representing the number of 100 rupee notes. The second input is an integer representing the number of 10 rupee notes. The third input is an integer representing the number of 1 rupee notes. The fourth input is an integer representing the price of the item. Output ------ You have to output 1 if the item is affordable. You have to output 0 if the item is not affordable

13th Jan 2023, 9:59 AM
Boom Bam Boy
Boom Bam Boy - avatar
9 Answers
0
#include <stdio.h> int main(){ int hundred , ten , one , price; scanf("%d %d %d %d" , &hundred , &ten , &one , &price); if(hundred <0 || ten<0 || one<0 || price<0){ printf("%d" ,0); return 0; } if(price < (hundred*100 + ten*10 + one)){ printf("%d" , 1) ; } else{ printf("%d" , 0); } return 0; }
14th Jan 2023, 9:24 AM
Kanishk Bakshi
0
🍆🍆🖕🏿🖕🏿🖕🏿🖕🏿😂🤮🤮🥰🥰
15th Jan 2023, 3:39 AM
Cristian Gonzalez
Cristian Gonzalez - avatar
0
#include<stdio.h> int main() { int Hundred; int Ten; int One; int Price; scanf("%d %d %d %d",&Hundred,&Ten,&One,&Price); if(Hundred<0 || Ten<0 || One<0 || Price<0) { printf("%d",0); return 0; } if(Price<(Hundred*100+Ten*10+One)) { printf("The item is affordable %d",1); } else { printf("The item is non affordable %d",0); } return 0; }
31st Jan 2023, 3:02 PM
SURYAPRAKASH R
SURYAPRAKASH R - avatar
0
You have a certain number of 100 rupee notes, 10 rupee notes and 1 rupee notes with you. There is an item you want to buy whose price is given to you. Write a program to find if the item is affordable, that is the price of the item is less than or equal to the current money you have. nput ----- Four non negative integers. The first input is an integer representing the number of 100 rupee notes. The second input is an integer representing the number of 10 rupee notes. The third input is an integer representing the number of 1 rupee notes. The fourth input is an integer representing the price of the item. Output ------ You have to output 1 if the item is affordable. You have to output 0 if the item is not affordable.
3rd Feb 2023, 11:33 AM
sheethal gk
sheethal gk - avatar
0
You have a certain number of 100 rupee notes, 10 rupee notes and 1 rupee notes with you. There is an item you want to buy whose price is given to you. Write a program to find if the item is affordable, that is the price of the item is less than or equal to the current money you have. input ----- Four non negative integers. The first input is an integer representing the number of 100 rupee notes. The second input is an integer representing the number of 10 rupee notes. The third input is an integer representing the number of 1 rupee notes. The fourth input is an integer representing the price of the item. Output ------ You have to output 1 if the item is affordable. You have to output 0 if the item is not affordable.
3rd Feb 2023, 11:35 AM
sheethal gk
sheethal gk - avatar
0
#include <stdio.h> int main(){ int hundred , ten , one , price; scanf("%d %d %d %d" , &hundred , &ten , &one , &price); if(hundred <0 || ten<0 || one<0 || price<0){ printf("%d" ,0); return 0; } if(price < (hundred*100 + ten*10 + one)){ printf("%d" , 1) ; } else{ printf("%d" , 0); } return 0; }
3rd Feb 2023, 7:45 PM
HAJRA KAUSAR
HAJRA KAUSAR - avatar
0
#include <stdio.h> int main(){ int hundred , ten , one , price; scanf("%d %d %d %d" , &hundred , &ten , &one , &price); if(hundred <0 || ten<0 || one<0 || price<0){ printf("%d" ,0); return 0; } if(price < (hundred*100 + ten*10 + one)){ printf("%d" , 1) ; } else{ printf("%d" , 0); } return 0; }
3rd Feb 2024, 1:46 PM
Anshul Upadhyay
Anshul Upadhyay - avatar
0
its not executed
5th Feb 2024, 9:06 AM
Nadipena Ramesh Talks
Nadipena Ramesh Talks - avatar
0
#include<stdio.h> int main() { int h, t, o, tot; scanf("%d", &h); scanf("%d", &t); scanf("%d", &o); scanf("%d", &pr); int total = (100*h )+ (10*t) + o; if(total == pr) { printf("1"); } else { printf("0"); } }
8th Feb 2024, 3:21 PM
Souvik Das
Souvik Das - avatar