Hi! I would like to seek advice or insights regarding this lengthy program that I made for an assignment and was wodering if it can be shortened or if there is something wrong with it, although it works fine.
Here's the code:
Code:
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main(void)
{
char name[20];
printf("Enter Lastname Initial: ");
scanf("%s", name);
if(name[0]=='a' || name[0]=='c' || name[0]=='b' || name[0]=='d' || name[0]=='e' || name[0]=='f' || name[0]=='g' || name[0]=='h' || name[0]=='i' || name[0]=='j' || name[0]=='k' || name[0]=='l' || name[0]=='m')
{
printf("\nLine # 2");
}
if(name[0]=='n' || name[0]=='o' || name[0]=='p' || name[0]=='q' || name[0]=='r' || name[0]=='s' || name[0]=='t' || name[0]=='u' || name[0]=='v' || name[0]=='w' || name[0]=='x' || name[0]=='y' || name[0]=='z')
{
printf("\nLine # 1");
}
getche();
}
Thanks for the help!! ^^