Home C C++ Java Python Perl PHP SQL JavaScript Linux Online Test

Home » C » Solved Programs » Dind frequency of any number between two numbers

Find frequency of any number between two numbers

This program ask user to input two numbers and one number whose frequency is to be calculated. Output of this code is number of times the number is present. Like 1 is present 2 times in 1 to 10

#include <stdio.h>

int main()
int startNo, endNo, no, counter, i;
counter = i = 0;

printf("%d", 123%10);

printf("\nEnter Starting Number : ");
scanf("%d", &startNo);
printf("\nEnter Ending Number : ");

printf("\nNow enter number whose frequany you want to check : ");

for(int i=startNo; i<=endNo; i++){
    int temp = i;
        if(temp%10 == no)
        temp = temp/10;

printf("\nCount is : %d", counter);

return 0;

c program to find frequency of any number