0
Some help
Pls
6 ответов
+ 2
Please mention the tag in what code problem
#include <stdio.h>
int main() {
int temp;
printf ("Enter the temperature\n");
scanf("%d",&temp);
if(temp >=80){printf("swimming\n");}
else if(60<=temp && temp<80){printf ("tennis\n");}
else if(40<=temp && temp<60){printf ("golf\n");}
return 0;
}
And use && operator and don't need to print else statement because you already mention in if statement, if(temp>=80).
+ 2
You don't need double condition like 60<=temp||temp<80 etc..
#include <stdio.h>
int main(void) {
int temp;
printf ("Enter the temperature\n");
scanf("%d",&temp);
puts(temp > 79?"swimming\n":
temp > 59?"tennis\n":
temp > 39?"golf\n":
"skying\n");
return 0;
}
+ 2
Thanks
0
Hello. What do you need help with? Please specify
0
#include <stdio.h>
int main() {
int temp;
printf ("Enter the temperature\n");
scanf("%d",&temp);
if(temp >=80){printf("swimming\n");}
else if(60<=temp || temp<80){printf ("tennis\n");}
else if(40<=temp || temp<60){printf ("golf\n");}
else {printf ("skying\n");}
return 0;
}
0
Can you correct it
The golf and skying output doesn't go