My issue
When I tried it using nested while loop is displayed Time limit exceeded. How can we solve it without using loops?
My code
#include <stdio.h>
int main(void) {
// your code goes here
int t,i=0,count=0;
scanf("%d",&t);
while(i<t){
int n;
scanf("%d",&n);
while(n>=0){
int ld=n%10;
if(ld==4){
count++;
}
n/10;
}
printf("%d",count);
}
return 0;
}
Problem Link: LUCKYFR Problem - CodeChef