Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int counter()
- {
- int zeros, ones, twos, threes, fours, fives, sixs, sevens, eights, nines;
- int done = 0;
- int lastchar = 0;
- int c;
- zeros = 0;
- ones = 0;
- twos = 0;
- threes = 0;
- fours = 0;
- fives = 0;
- sixs = 0;
- sevens = 0;
- eights = 0;
- nines = 0;
- while(done == 0)
- {
- c = 112234;
- if(c == '0')
- {
- ++zeros;
- }
- else if(c == '1')
- {
- ++ones;
- }
- else if(c == '2')
- {
- ++twos;
- }
- else if(c == '3')
- {
- ++threes;
- }
- else if(c == '4')
- {
- ++fours;
- }
- else if(c == '5')
- {
- ++fives;
- }
- else if(c == '6')
- {
- ++sixs;
- }
- else if(c == '7')
- {
- ++sevens;
- }
- else if(c == '8')
- {
- ++eights;
- }
- else if(c == '9')
- {
- ++nines;
- }
- else
- {
- printf("done");
- break;
- }
- }
- printf("zeros:%d \n ones:%d \n twos:%d \n threes:%d \n fours:%d \n fives:%d \n sixs:%d \n sevens:%d \n eights:%d \n nines:%d \n", zeros, ones, twos, threes, fours, fives, sixs, sevens, eights, nines);
- }
- int main()
- {
- counter();
- return 0;
- }
- here is my code for the counter function so that it would count the digits in pi.c(junk and Yeats)
Add Comment
Please, Sign In to add comment