Rishab tata
asked on
CodeChef Problem - LuckyFour
Link to the problem:
The code works fine on my own system, but while submitting shows wrong answer?
The code works fine on my own system, but while submitting shows wrong answer?
#include <stdio.h>
void main()
{
int t, n, count;
scanf("%d", &t);
while(t--)
{
count=0;
scanf("\n%d",&n);
while(n>0){
if(n%10==4)
{
count++;
}
n=n/10;
}
printf("\n%d", count);
}
}
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
note, the
Open in new window
should be changed to
Open in new window
if doing so, the following code should work:
Open in new window
Sara