1 /*C How to Program, 6/E, Deitel & Deitel.
3 Solution of exercise 3.39:
4 (Counting 7s) Write a program that reads an integer and determines and prints
5 how many digits in the integer are 7s.
7 Written by Juan Carlos Moreno (jcmhsoftware@gmail.com), 2023-02-11.*/
13 int number
, digit
, number2
;
14 int power_of_ten
= 1000000000, counter
= 0;
16 printf("Enter the number: ");
20 while (power_of_ten
>= 1)
22 digit
= number2
/ power_of_ten
;
23 number2
= number2
% power_of_ten
;
24 power_of_ten
= power_of_ten
/ 10;
31 printf("There are %d 7s in the integer %d.\n", counter
, number
);