Skip to content

Instantly share code, notes, and snippets.

@omkar98
Created July 16, 2016 02:28
Show Gist options
  • Save omkar98/b8f6207dff5bcd44f6fa95a5f10d4e7c to your computer and use it in GitHub Desktop.
Save omkar98/b8f6207dff5bcd44f6fa95a5f10d4e7c to your computer and use it in GitHub Desktop.
#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