ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
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
 Question Submitted By :: J
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 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
# 1
#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 ?    0 Yes 0 No
Abdur Rab
 
  Re: 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
# 2
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
char ch;
int no;
printf("Enter the charactor:");
scanf("%c",&ch);
if(int(ch)>=65&&int(ch)<=91)
{
no=int(ch)-64;
printf("%d\n",no);
}
if(int(ch)>=97&&int(ch)<=123)
{
no=int(ch)-96;
printf("%d\n",no);
}
getch();
}
 
Is This Answer Correct ?    0 Yes 0 No
Gourav Agrawal
 
 
 
  Re: 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
# 3
#include<stdio.h>
#include<conio.h>
void main()
{
char s;
printf("enter the character :");
scanf("%d",&s);
printf("\n here CAPITAL and SMALL letters are taken as same\n");
if(s>='A'&&s<='Z')
printf("\nthis is the %dth alphabet from first",s-'A');
else if(s>='a'&&s<='z')
printf("\nthis is the %dth alphabet from first",s-'a');
else
printf("\n INVALID ALPHABET");
getch();
}


thank u
 
Is This Answer Correct ?    1 Yes 0 No
Vignesh1988i
 
  Re: 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
# 4
#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 ?    0 Yes 0 No
Vaibhav Srivastava
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
program to find the ASCII value of a number  5
what is the use of keyword volatile?? LG-Soft4
What are the uses of pre-processor directives?  2
read the folllowing code # define MAX 100 # define MIN 100 .... .... if(x>MAX) x=1; else if(x<MIN) x=-1; x=50; if the initial value of x=200,what is the vlaue after executing this code? a.200 b.1 c.-1 d.50 TCS2
Difference Between embedded software and soft ware? Bosch1
HOW TO ANSWER IF ASKED " WHAT KIND OF A PERSON ARE YOU?" I NEED AN ANSWER THAT IMPRESS THE INTERVIEWER  2
write an algorithm to get a sentence and reverse it in the following format: input : I am here opuput: Here Am I note: first letter of every word is capiatlised  2
what is the size of an integer variable?  1
what is the difference between normal variables and pointer variables.............. Satyam7
I have an array of 100 elements. Each element contains some text. i want to: append a star character to the end of every fifth element remove every second character from every tenth element, and… add a line feed (ascii 10) after the 30th character of every array element whose length is greater than 30 characters.  1
What are bit fields? What is their use? Adobe1
macros and function are related in what aspect? a)recursion b)varying no of arguments c)hypochecking d)type declaration HCL8
Define function ?Explain about arguments? Geometric-Software2
how to make c program without a libary? e.g.#include<stdio.h> libary is not in c progaram.  1
How can I get Single byte from 'int' type variable? Can we alter single bit or multiple bits in int type variable? if so, How?  2
design and implement a program that reads floating-points numbers in a sentinel-controlled loop until the user terminates the program by entering zero.your program should determinate and print the smallest,largest and average of the supplied numbers.  1
what is Structural oriented language? give some example of this language.....?  1
what is the diference between pointer to the function and function to the pointer?  2
void swap(int a,int b) { a=a+b; b=a-b; a=a-b; } in this code always gives the same result for all case TCS7
what is c? Tech-Mahindra5
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com