Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is hashing in c?

1165


Is there a built-in function in C that can be used for sorting data?

1269


void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }

1727


What are global variables?

1195


What is maximum size of array in c?

1047


State the difference between realloc and free.

1087


What is the purpose of void pointer?

1036


How can I automatically locate a programs configuration files in the same directory as the executable?

1169


Explain what is wrong with this program statement?

1121


How do I read the arrow keys? What about function keys?

1088


Explain what is the general form of a c program?

1099


What is "Duff's Device"?

1170


Is it possible to have a function as a parameter in another function?

1081


Is c compiled or interpreted?

1194


What is derived datatype in c?

1099