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 |
Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given
If you know then define #pragma?
a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor
Explain how can you be sure that a program follows the ansi c standard?
What is the difference between fread and fwrite function?
how write a addtion of two single dimensional array using of pointer in c language?
What is the use of static variable in c?
Explain spaghetti programming?
What is const volatile variable in c?
How to access or modify the const variable in c ?
16 Answers HCL, HP,
What are run-time errors?
What is the difference between a string and an array?