Program to print student information
void name(void); void age(void); studentdata() { printf("Student information\n"); name(); age(); printf("we are in main function\n"); exit(0); } void name(void) { char ch; printf("enter any character between A-Z\n"); ch=getchar(); putchar(ch); if((ch>='a')&&(ch<='n')) { printf("name is MADANREDDY\n"); } else { printf("name is SURESH\n"); } } void age(void) { int n; printf("enter value for n:\n"); scanf("%d",&n); if((n>0)&&(n<14)) { printf("child\n"); } else if((n>14)&&(n<30)) { printf("young age\n"); } else if((n>30)&&(n<60)) { printf("middle age\n"); } else if(n>60) { printf("old age"); } }OutPut:
madan@madan-Lenovo-G570:~/madan$ vi studentinfo.c madan@madan-Lenovo-G570:~/madan$ cc -nostartfiles studentinfo.c madan@madan-Lenovo-G570:~/madan$ ./a.out Student information enter any character between A-Z e ename is MADANREDDY enter value for n: 56 middle age we are in main function