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 / gourav agrawal
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
char ch;
int no;
printf("Enter the charactor:");
scanf("%c",&ch);
if(int(ch)>=65&&int(ch)<=91)
{
no=int(ch)-64;
printf("%d\n",no);
}
if(int(ch)>=97&&int(ch)<=123)
{
no=int(ch)-96;
printf("%d\n",no);
}
getch();
}
| Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
What are header files in c?
Is c is a high level language?
Describe how arrays can be passed to a user defined function
What is wrong with this initialization?
What is merge sort in c?
How do you search data in a data file using random access method?
What is an array in c?
Describe the header file and its usage in c programming?
When should structures be passed by values or by references?
in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above
how could explain about job profile
What is chain pointer in c?
How are variables declared in c?
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].
write a program for the normal snake games find in most of the mobiles.