why am I getting wrong answer?

#include<stdio.h>
int main()
{
int num,mod,i=0;
printf(“Enter the number to find out 4 in a string of numbers:”);
scanf("%d",&num);
while(num!=0)
{
mod=num%10;
if(mod==4)
i++;
num=num/10;
}
printf(“No. of 4 in a string of numbers is %d”,i);
return 0;
}
/Why am I getting this as wrong answer/

If the length of string is >10^18,then you can’t store it even in long long int,to take input with string and iterate :slight_smile: