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 a memory leak? How to avoid it?

1358


What is the difference between exit() and _exit() function in c?

1083


What is difference between far and near pointers?

1060


Discuss the function of conditional operator, size of operator and comma operator with examples.

1167


In a switch statement, what will happen if a break statement is omitted?

1071


How can I open files mentioned on the command line, and parse option flags?

1075


When should we use pointers in a c program?

1147


the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above

1262


What is the heap in c?

1088


Can you explain what keyboard debouncing is, and where and why we us it? please give some examples

2210


What is the use of getchar functions?

1186


Why clrscr is used after variable declaration?

1703


i want to know the procedure of qualcomm for getting a job through offcampus

2477


Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.

1289


Explain the difference between structs and unions in c?

1033