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                      
tip   SiteMap shows list of All Categories in this site.
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
How to find the given no is odd or even without checking of 
any condition and loops. (Hint: Using array)
 Question Submitted By :: R. Ananda Devi
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How to find the given no is odd or even without checking of any condition and loops. (Hint: Using array)
Answer
# 1
import java.io.*;
public class even {
	public static void main(String arg[])throws 
IOException
	{
		String a[]={"even","odd"};
		BufferedReader br=new BufferedReader(new 
InputStreamReader(System.in));
		int n;
		System.out.println("Enter no to find");
		n=Integer.parseInt(br.readLine());
		n=n%2;
		System.out.println("given no is  "+a[n]);
		
	}

}
 
Is This Answer Correct ?    7 Yes 0 No
Amala V
 
  Re: How to find the given no is odd or even without checking of any condition and loops. (Hint: Using array)
Answer
# 2
void main()
{
       int n;
       char s[]={"even","odd"};
       printf("Enter the no.:");
       scanf("%d",&n);
       n=n%2;
       printf("th no. is %s",s[n]);
       getch();
}
 
Is This Answer Correct ?    3 Yes 1 No
Vaishu
 
 
 
  Re: How to find the given no is odd or even without checking of any condition and loops. (Hint: Using array)
Answer
# 3
void main()
{
       int n;
       char *s[4]={"even","odd"};
       printf("Enter the no.:");
       scanf("%d",&n);
       n=n%2;
       printf("th no. is %s",s[n]);
       getch();
}
 
Is This Answer Correct ?    3 Yes 0 No
Ligory Antony
 
  Re: How to find the given no is odd or even without checking of any condition and loops. (Hint: Using array)
Answer
# 4
void main()
{
       int n;
       char s[20][20]={"even","odd"};
       printf("Enter the no.:");
       scanf("%d",&n);
       n=n%2;
       printf("th no. is %s",s[n]);
       getch();
}
 
Is This Answer Correct ?    1 Yes 0 No
Anandi
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
int main() { int *p=new int; *p=10; del p; cout<<*p; *p= 60; cout<<*p; } what will be the output & why? TCS4
Program to find the value of e raised to power x using while loop N-Tech3
c program to add and delete an element from circular queue using array  1
Give the output for the following program. #define STYLE1 char main() { typedef char STYLE2; STYLE1 x; STYLE2 y; clrscr(); x=255; y=255; printf("%d %d\n",x,y); } ADITI1
how does the C compiler interpret the following two statements p=p+x; q=q+y; a.p=p+x; q=q+y b.p=p+xq=q+y c.p=p+xq; q=q+y d.p=p+x/q=q+y TCS3
write a program to swap Two numbers without using temp variable. HP22
Write a C++ program without using any loop (if, for, while etc) to print numbers from 1 to 100 and 100 to 1;  7
int arr[] = {1,2,3,4} int *ptr=arr; *(arr+3) = *++ptr + *ptr++; Final contents of arr[] Hughes4
wap in c to accept n number display the highest and lowest value  2
pgm to reverse string using arrays i.e god is love becomes love is god) (assumption:only space is used for seperation of words) no addtional memory used.i.e no temporary arrays can used. Persistent4
What is the memory allocated by the following definition ? int (*x)[10]; ADITI3
Why doesn't the code "a[i] = i++;" work?  4
how to return 1000 variables from functio9n in c?plz give me code also  5
what is calloc and malloc?  1
Which of the following about automatic variables within a function is correct ? a.its type must be declared before using the variable b.they are local c.they are not initialised to zero d.they are global. TCS3
What is RAM memory? and What is ROM?Who designed one is temparary and another is permanent?why they designed like that?By using far pointer which type data(whether hexadecimal)we can access? Excel1
what type of language is C? Microsoft2
What is structure padding ? HP2
study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above Accenture13
int *p=20; if u print like dis printf("%d",p); o\p:- 20; how is it possible? plz give me the explanation. Global-Edge11
 
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