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
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon
What is the importance of c in your views?
Write a factorial program using C.
What is external variable in c?
Study the following C program :call_me (myvar)int myvar;{ myvar +- 5; }main(){int myvar;myvar = 3;call_me(myvar);printf("%d ",myvar);What will be printed a) 3 b) 5 c) 8 d) symbol
Define C in your own Language.
please give me some tips for the placement in the TCS.
Explain how can I convert a number to a string?
Explain is it better to bitshift a value than to multiply by 2?
Can we use any name in place of argv and argc as command line arguments?
What is the difference between a string and an array?
How can I generate floating-point random numbers?
.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }
What is the difference between far and near ?
What is the correct code to have following output in c using nested for loop?