Quote:
How do I write program for this question for codechef challenge
Pay attention to variables usage. Be consistent.
#include<stdio.h>
int main()
{
int A,G,L;
scanf("%d",&A);
while(A--)
{
scanf("%d%d",&G,&L);
if (A>0 && G>0)
printf("solution \n");
else if(G==0)
printf("solid \n");
else if(A==0)
printf("liquid \n");
}
return 0;
}
Advice: Learn to indent properly your code, it show its structure and it helps reading and understanding. It also helps spotting structures mistakes.
Indentation style - Wikipedia[
^]
Best C++ Formatter and Beautifier[
^]
Online C/C++ Formatter, Indenter and Beautifier – Techie Delight[
^]
Professional programmer's editors have this feature and others ones such as parenthesis matching and syntax highlighting.
Notepad++ Home[
^]
ultraedit[
^]
Enabling Open Innovation & Collaboration | The Eclipse Foundation[
^]