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 / shams

#include <iostream>

using namespace std;

int main()
{
char n;
cout<<"Enter a character";
cin>>n;
int no=int(n)>=97?int(n)-96:int(n)-64;
cout<<no;
return 0;
}

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is const volatile variable in c?

1037


What is the condition that is applied with ?: Operator?

1133


Can we declare variables anywhere in c?

1002


What is a union?

1038


What is the correct code to have following output in c using nested for loop?

1087


What is difference between structure and union?

1134


How is actual parameter different from the formal parameter?

1026


Which of these functions is safer to use : fgets(), gets()? Why?

1112


What is main () in c?

1076


Difference between macros and inline functions? Can a function be forced as inline?

1276


Explain is it valid to address one element beyond the end of an array?

1218


Is c easier than java?

1081


Do array subscripts always start with zero?

1304


Why is C language being considered a middle level language?

1130


Write a program to swap two numbers without using a temporary variable?

1128