Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

counting 7s in an integer c

long int num;
     int i = 0;
    printf("Enter An Integer: ");
    scanf("%ld", &num);
    while(num != 0){
        i+= (num % 10)/7;
        num /= 10;
    }
    printf("The Number Of Sevens In This Integer Is: %d", i);
 
PREVIOUS NEXT
Tagged: #counting #integer
ADD COMMENT
Topic
Name
8+3 =