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 / vaibhav srivastava

#include<stdio.h>
int main()
{
char c;
int i;
printf("Enter any char\t");
scanf("%c",&c);
if ( c>=65 && c<=92)

printf("%d\n",c-64);

else if( c>=97 && c<=122)

printf("%d\n",c-96);
else
printf("\n\nWrong Input\n\n");

}

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what will be the output for the following main() { printf("hi" "hello"); }

10942


Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].

1079


What are volatile variables in c?

925


Where are c variables stored in memory?

1054


How can you pass an array to a function by value?

1097


Synonymous with pointer array a) character array b) ragged array c) multiple array d) none

1043


Ow can I insert or delete a line (or record) in the middle of a file?

983


What are local variables c?

990


What is nested structure with example?

1055


Why can arithmetic operations not be performed on void pointers?

1020


Why do we need a structure?

1018


Can we initialize extern variable in c?

1112


what is the basis for selection of arrays or pointers as data structure in a program

4291


How do I determine whether a character is numeric, alphabetic, and so on?

1115


What is static identifier?

1208