logical operator and while loop

what i am doing wrong?

1
2
3
4
5
6
7
8
9
10
11
12
#include<stdio.h>

int main()
{
    int num;
    do
    {
        printf("enter 1 2 or 3 to exit : ");
        scanf("%d",&num);
    }while(num!=1 || num!=2 || num!=3);
    return 0;
}
(num!=1 || num!=2 || num!=3)
is the same as
(true)

Can you think of a value of num for which num!=1 || num!=2 || num!=3 will be false?
Last edited on
so he means that you should use && instead of ||
thanks. XD
Topic archived. No new replies allowed.