+ 14
/* u forgot & in scanf and it's \n (backslash) Solution:- */ #include <stdio.h> #include <stdlib.h> int main() { int mon_val,hun,fifty,extra_val,ten,five,two,one; printf("Please enter any number and see the magic ?\n"); scanf("%d",&mon_val); extra_val=(mon_val-hun*100); hun=mon_val/100; fifty=extra_val/50; ten=(extra_val-50)/10; five=((extra_val-50)-(ten*10))/5; two=((extra_val-50)-(ten*10))/2; one=((extra_val-50)-(ten*10))/1; printf("The number of hundred bills needed is %d\n ",hun); printf("The number of fifty bills needed is %d\n ",fifty); printf("The number of tens bills needed is %d\n ",ten); printf("The number of five bills needed is %d\n ",five); printf("The number of two bills needed is %d\n ",two); printf("The number of ones bills needed is %d\n ",one); return 0; }
19th Jan 2018, 6:48 PM
🌛DT🌜
🌛DT🌜 - avatar