Created
July 16, 2016 02:28
-
-
Save omkar98/b8f6207dff5bcd44f6fa95a5f10d4e7c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
void main() | |
{ | |
float p,q,r; | |
float x,y; | |
int a,b,c; | |
printf("PUZZLE "); | |
printf("\n\nPlease Note: You can answer only ONCE. No other chance to be given. "); | |
char city[6]; | |
printf("\n-------------------------------------------------------------------"); | |
printf("\n(1) Enter a city name ending with \'la\' and has 6 letters:\nAns: "); | |
scanf("%s",&city); | |
a=printf(city); | |
printf("%s", a==6 ? ": CORRECT" : ": WRONG"); | |
p=(a==6 ? 1 : 0); | |
char fruit[6]; | |
printf("\n--------------------------------------------------------------------"); | |
printf("\n(2) Enter a fruit name ending with \'man\' and has 5 letters:\nAns: "); | |
scanf("%s",&fruit); | |
b=printf(fruit); | |
b==5 ? printf(": You got that right!") : printf(": INCORRECT"); | |
q=(b==5 ? 1 : 0); | |
char veggi[11]; | |
printf("\n--------------------------------------------------------------------"); | |
printf("\n(3) A veggi that is a flower: \nAns: "); | |
scanf("%s",&veggi); | |
c=printf(veggi); | |
c==11 ? printf(": You got that right!") : printf(": INCORRECT"); | |
r=(c==11 ? 1 : 0); | |
printf("\n--------------------------------------------------------------------"); | |
x=(p+q+r); | |
y=((x/3)*100); | |
printf("\nTotal Points : %g\nPercentage: %g", x,y); | |
printf("\n--------------------------------------------------------------------"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment