- Aug 30, 2004
- 2,519
- 1
- 81
solution to this exercize:
Write a program that sorts the number of twenties,tens,fives,and ones from a user inputted value. From the book K.N.King C Progr
amming: A Modern Approach 2nd Edition....pg 34 ex.7.
I am studying this on google books. By the way this is Not homework I am 61 years old. My program compiles and works
but I would just like some experienced coders to look it over and
tell me what they think. Thanks
Write a program that sorts the number of twenties,tens,fives,and ones from a user inputted value. From the book K.N.King C Progr
amming: A Modern Approach 2nd Edition....pg 34 ex.7.
I am studying this on google books. By the way this is Not homework I am 61 years old. My program compiles and works
but I would just like some experienced coders to look it over and
tell me what they think. Thanks
Code:
/*Sorts twenties,tens,fives,and ones*/
#include <stdio.h>
int main(void)
{
int T=(20),t=(10),f=(5),o=(1);
int Tv,tv,fv,ov;/*number of each dollar value*/
int value;
printf("Enter a dollar amount 1-100\n");/*I limited this value*/
scanf("%d", &value);
Tv=value / T;
tv=(value % T)/t;
fv=(value % t)/f;
ov=(value % T % t % f);
printf("There are %d twenties %d tens %d fives and %d ones\n", Tv ,tv, fv, ov);
return 0;
}
Last edited:
