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 / abdur rab
#include <stdio.h>
int main ( int argc, char* argv [] )
{
char ch = '0';
int nvalue = 0;
while ( 1 ) {
printf ("\n Enter the alphabet or press 0
to exit :");
scanf ( "%c", &ch );
if ( ch == '0' ) break;
nvalue = ( ( (int) 'a' <= (int) ch ) && (
(int) 'z' >= (int) ch ) )
? ~( (int) 'a' - (int) ch ) + 2
: ( ( (int) 'A' <= (int) ch ) && (
(int) 'Z' >= (int) ch ) )
? ~( (int) 'A' - (int) ch ) + 2
: 0;
printf ("\n The Value :%d", nvalue );
}
return ( 0 );
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What are the types of unary operators?
What is the importance of c in your views?
What is self-referential structure in c programming?
How can I open a file so that other programs can update it at the same time?
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference
What is use of #include in c?
How can I determine whether a machines byte order is big-endian or little-endian?
When a c file is executed there are many files that are automatically opened what are they files?
What does nil mean in c?
How pointers are declared?
The __________ attribute is used to announce variables based on definitions of columns in a table?
Once I have used freopen, how can I get the original stdout (or stdin) back?
hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell
How will you divide two numbers in a MACRO?
Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.