#include <stdio.h>
#include <stdlib.h>
int totalthousand=1000;
int totalfivefundred=100;
int totalonehundred=1000;
int main()
{
printf("code make by ameer hamza\nfor more help programming chake out my blog");
printf("letsdoprogramminginc.blodspot.com\n");
unsigned long withdrawamount;
unsigned longmomeny;
int totalmoney,
thousand=0,fivehundred=0,onehundred=0;
printf("enter the amount in multiply 0f 100:\n");
scanf("%lu",&withdrawamount);
if(withdrawamount%100!=0)
{
printf("invalid amount");
return 0;
}
totalmoney=totalthousand*1000+totalfivefundred*500+totalonehundred*100;
if(withdrawamount>totalmoney)
{
printf("sorrey,insuffcint money");
return 0;
}
thousand=withdrawamount/1000;
if(thousand>totalthousand)
thousand=totalthousand;
withdrawamount=withdrawamount-thousand*1000;
if(withdrawamount>0)
{
fivehundred=withdrawamount/500;
if(fivehundred>totalfivefundred)
fivehundred=totalfivefundred;
withdrawamount=withdrawamount-fivehundred*500;
}
if(withdrawamount>0 )
onehundred=withdrawamount/100;
printf("total 1000 note:%d\n",thousand);
printf("total 500 note:%d\n",fivehundred);
printf("total 100 note:%d\n",onehundred);
return 0;
}
No comments:
Post a Comment