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.



Write a program in C to print the alphabets in order as on a mobile phone.i.e:When 2 is pressed onc..

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

Post New Answer

More C Interview Questions

What is structure in c explain with example?

0 Answers  


in b=6.6/a+(2*a+(3*c)/a*d)/(2/n); which operation will be performed first a) 6.6/a b) 2*a c) 3*c d) 2/n

1 Answers  


what is c

1 Answers  


What is character set?

0 Answers  


what is foreign key in c language?

1 Answers   ADP,






read an array and search an element

1 Answers  


actually i have 2 years teaching experience as computer faculty but now i am a DBA but when i go for interview many peoples asked me why i left my teaching profession and why i want to come in this field kindly give me the proper answer of this queston

3 Answers   Ramco,


program for following output using for loop? 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5

8 Answers   Aptech, Infosys,


how to find the kth smallest element in the given list of array elemnts.

8 Answers   Silicon,


What is the use of ?

0 Answers  


i want to job in your company, so how it will be possible.

3 Answers   TCS,


How can you avoid including a header more than once?

0 Answers  


Categories