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
What is const volatile variable in c?
What is the condition that is applied with ?: Operator?
Can we declare variables anywhere in c?
What is a union?
What is the correct code to have following output in c using nested for loop?
What is difference between structure and union?
How is actual parameter different from the formal parameter?
Which of these functions is safer to use : fgets(), gets()? Why?
What is main () in c?
Difference between macros and inline functions? Can a function be forced as inline?
Explain is it valid to address one element beyond the end of an array?
Is c easier than java?
Do array subscripts always start with zero?
Why is C language being considered a middle level language?
Write a program to swap two numbers without using a temporary variable?