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 nested structure with example?

1012


How many levels of indirection in pointers can you have in a single declaration?

1026


Explain the use of #pragma exit?

1112


Write a C program to count the number of email on text

1853


What does the c preprocessor do?

1050


The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none

1194


What is the use of c language in real life?

973


Can we access the array using a pointer in c language?

995


What happens if header file is included twice?

1090


Explain what are run-time errors?

1037


Why is c called a structured programming language?

1214


Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above

1095


What is a struct c#?

999


What is the use of a static variable in c?

1008


How can I call a function with an argument list built up at run time?

1173