Write a program in C to print the alphabets in order as on a
mobile phone.i.e:When 2 is pressed once 'a' prints and if it
is pressed two times 'b' prints and so on.we have to print
all the alphabets as on mobile phone like this.
Answer / balakrishna
void main()
{
int n;int i;int d[100]; char str[100];
clrscr();
printf("\nhow much text u want to print with
spaces...");
scanf("%d",&n);
printf("\nEnter ur message as assuming cellphone
keypad...eg:\npress 2 to print a");
for(i=0;i<n;i++)
{
scanf("%d",&d[i]);
switch(d[i])
{
case 2:
str[i]='a';
break;
case 22:
str[i]='b';
break;
case 222:
str[i]='c';
break;
case 3:
str[i]='d';
break;
case 33:
str[i]='e';
break;
case 333:
str[i]='f';
break;
case 4:
str[i]='g';
break;
case 44:
str[i]='h';
break;
case 444:
str[i]='i';
break;
case 5:
str[i]='j';
break;
case 55:
str[i]='k';
break;
case 555:
str[i]='l';
break;
case 6:
str[i]='m';
break;
case 66:
str[i]='n';
break;
case 666:
str[i]='o';
break;
case 7:
str[i]='p';
break;
case 77:
str[i]='q';
break;
case 777:
str[i]='r';
break;
case 7777:
str[i]='s';
break;
case 8:
str[i]='t';
break;
case 88:
str[i]='u';
break;
case 888:
str[i]='v';
break;
case 9:
str[i]='w';
break;
case 99:
str[i]='x';
break;
case 999:
str[i]='y';
break;
case 9999:
str[i]='z';
break;
case 1:
str[i]=' ';
break;
}
}
printf("\n ur message....%s",str);
getch();
}
| Is This Answer Correct ? | 6 Yes | 4 No |
Main must be written as a.the first function in the program b.Second function in the program c.Last function in the program d.any where in the program
19 Answers CTS, HCL, TCS,
HOW TO FIND OUT THE RREVERS OF A GIVEN DIGIT NUMBER IF IT IS INPUT THROUGH THE KEYBORD BY USING C LANGUAGE
what are bit fields in c?
What is a good data structure to use for storing lines of text?
Why C language is a procedural language?
Explain function?
Why is c called c not d or e?
I have a function which accepts a pointer to an int. How can I pass a constant like 5 to it?
Is main a keyword in c?
What is n in c?
Can we access RAM? How? Whats the range of access? Similarly What are other hardware we can access?
How do I send escape sequences to control a terminal or other device?