For an assignment I have to format a basic C program that I can make myself and make sure it is well indented. Is this ok from what I have done? Can I add that on my editor, the code in the if statement braces are closrer to the ident than they appear when I posted it, I dont know why C boards editor moves code around like this... Is there anything I can do to increase readabilty?
Code:
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main()
{
char let;
int num;
printf("Enter a letter( a - g ): ");
scanf("%c", &let);
if (( let >= 'a' ) && ( let <= 'g' ))
{
printf("\nYou entered %c", let);
printf("\nEnter two a number between 1 and 10: ");
scanf("%d", &num);
}
if (( num >= 1 ) && ( num <= 9 ))
{
printf("\nYou entered: %d", num);
}
else
{
printf("\nListen to commands!");
}
getch();
return 0;
}