C program

closed account (1vf9z8AR)
Upon entering t as 1 why doesn't the program register the first input? Instead, the second input produces the result and the first is just ignored

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  #include<stdio.h>
int main()
{
    int t,n,x,y;
    scanf("%d\n",&t);
    while(t>0)
    {
        scanf("%d%d%d\n",&n,&x,&y);
        for(int i=1;i<n;i++)
        {
            if(i%x==0 && i%y!=0)
                printf("%d\t",i);
        }
        printf("\n");
        t--;
    }
    return 0;
}


even if i use t=t-1 the same problem?
Last edited on
closed account (1vf9z8AR)
ok I had to remove \n from scanf
Topic archived. No new replies allowed.