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...

How to find the given no is odd or even without checking of
any condition and loops. (Hint: Using array)

Answer Posted / amala v

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 ?    12 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is typedef?

1339


What is the best way to comment out a section of code that contains comments?

1267


Write a function stroverlap that takes (at least) two strings, and concatenates them, but does not duplicate any overlap. You only need to worry about overlaps between the end of the first string and the beginning of the second string. Examples: batman, manonthemoon = batmanonthemoon batmmamaman, mamamanonthemoon = batmmamamanonthemoon bat, man = batman batman, batman = batman batman, menonthemoon = batmanmenonthemoon

2236


How can I do peek and poke in c?

1039


Is c object oriented?

913


How can I rethow can I return a sequence of random numbers which dont repeat at all?

1151


What are data types in c language?

1016


Explain is it better to bitshift a value than to multiply by 2?

1142


C language questions for civil engineering

1656


How can you allocate arrays or structures bigger than 64K?

1085


What are the rules for the identifier?

1117


What is the right way to use errno?

1006


Why is c fast?

1012


What is page thrashing?

1029


swap 2 numbers without using third variable?

1086