using and ,or in the condition?

Hello everyone

I hope you all doing great

I am trying to write a code but it would show that there is an error with my code.

The real question is can I use "&&" which mean "and" and "||" in the condition.
if not what should i do with this code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  #include <stdio.h>



int main()
{
    int months,days;
   
    printf("enter the month and the day\n");
    scanf("%d %d",&months,days);
    if (months<=3&&days<=15)||(months==12&&days<=16)
        {
            if (months==1)
            printf("winter January %d",days);
            if (months==2)
            printf("winter February %d",days);
            if (months==3)
            printf("winter March %d",days);
            if (months==12)
            printf("winter December %d",days);
        
            else
                printf("error");
The real question is can I use "&&" which mean "and" and "||" in the condition.


Yes.


While I'm here, this is C++; not C.

Don't use stdio.h ; use iostream
This means also don't use printf. Use cout.
Don't use scanf. Use cin.
OMG . I thought that C and C++ have the same way of programming
hahahahahahaha
but that does not answer the main question
but that does not answer the main question


He did answer the main question -

He said -
Yes.

Topic archived. No new replies allowed.