Write a C Programm..
we press 'a' , it shows the albhabetical number is 1, if we
press 'g' it shows the answer 7.. any can help me
Answer Posted / anuroop khare
#include <stdio.h>
int main()
{
char input;
printf(" Please type the alphabet --> ");
scanf("%c", &input);
if ((input=='a')||(input=='A'))
printf("It represents number 1\n");
else if ((input=='b')||(input=='B'))
printf("It represents number 2\n");
else if ((input=='c')||(input=='C'))
printf("It represents number 3\n");
else if ((input=='d')||(input=='D'))
printf("It represents number 4\n");
else if ((input=='e')||(input=='E'))
printf("It represents number 5\n");
else if ((input=='f')||(input=='F'))
printf("It represents number 6\n");
else if ((input=='g')||(input=='G'))
printf("It represents number 7\n");
else if ((input=='h')||(input=='H'))
printf("It represents number 8\n");
else if ((input=='i')||(input=='I'))
printf("It represents number 9\n");
else if ((input=='j')||(input=='J'))
printf("It represents number 10\n");
else if ((input=='k')||(input=='K'))
printf("It represents number 11\n");
else if ((input=='l')||(input=='L'))
printf("It represents number 12\n");
else if ((input=='m')||(input=='M'))
printf("It represents number 13\n");
else if ((input=='n')||(input=='N'))
printf("It represents number 14\n");
else if ((input=='o')||(input=='O'))
printf("It represents number 15\n");
else if ((input=='p')||(input=='P'))
printf("It represents number 16\n");
else if ((input=='q')||(input=='Q'))
printf("It represents number 17\n");
else if ((input=='r')||(input=='R'))
printf("It represents number 18\n");
else if ((input=='s')||(input=='S'))
printf("It represents number 19\n");
else if ((input=='t')||(input=='T'))
printf("It represents number 20\n");
else if ((input=='u')||(input=='U'))
printf("It represents number 21\n");
else if ((input=='v')||(input=='V'))
printf("It represents number 22\n");
else if ((input=='w')||(input=='W'))
printf("It represents number 23\n");
else if ((input=='x')||(input=='X'))
printf("It represents number 24\n");
else if ((input=='y')||(input=='Y'))
printf("It represents number 25\n");
else if ((input=='z')||(input=='Z'))
printf("It represents number 26\n");
else
printf("you have entered a wrong alphabet");
return 0;
}
| Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
How many main () function we can have in a project?
What are loops c?
Explain the array representation of a binary tree in C.
What is typeof in c?
How do you write a program which produces its own source code as output?
What is extern storage class in c?
What does it mean when the linker says that _end is undefined?
How do you convert strings to numbers in C?
What is the value of c?
Is c++ based on c?
What is #define size in c?
Explain the difference between malloc() and calloc() function?
Why c is called a mid level programming language?
Can include files be nested?
Is sizeof a keyword in c?