No output confusion

Why this code didn’t give output for printf count written in program

#include <stdio.h>

int main(void) {
int d,m,y,count,t;
while(t–)
{
scanf("%d:%d:%d",&y,&m,&d);
if(m==1||m==3||m==5||m==7||m==8||m==10||m==12)
count=(31-d)/2+1;
else if(m==2)
{
if((y%4==0) && (y%100!=0 || y%400==0))
count=(29-d)/2+1;
else
count=(59-d)/2+1;

}
else
count=(61-d)/2+1;

printf("%d\n",count);

}
return 0;

}

your syntax for while loop is wrong.

while(condition)
{
}

1 Like

It appears as if you forgot to take the number of test cases as input.

2 Likes
  1. You have not taken input t.
  2. It should be while(t--) and not while(t–).
1 Like

Thanks I got my mistake
How I done a disgusting mistake

Mistake is a teacher. Learn from mistakes and try not to repeat them.

2 Likes