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

To find whether a number is even or odd without using any
conditional operator??

Answer Posted / amala v

import java.io.*;

public class even {
public static void main(String arg[])throws IOException
{
String a[]={"even","odd"};
int p;
BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
System.out.println("Enter a number to find:");
int n=Integer.parseInt(br.readLine());
p=n%2;
System.out.println("The Number is :"+a[p]);


}
}

Is This Answer Correct ?    24 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is python slower than c?

1091


Explain why can’t constant values be used to define an array’s initial size?

1357


What is string function in c?

988


What is the correct declaration of main?

1214


i want to know the procedure of qualcomm for getting a job through offcampus

2471


How can I do serial ("comm") port I/O?

1184


What is the difference between declaring a variable and defining a variable?

1281


the question is that what you have been doing all these periods (one year gap)

2090


Can you apply link and association interchangeably?

1125


How do you sort filenames in a directory?

1185


Why do we need a structure?

1043


What is difference between stdio h and conio h?

1383


Explain spaghetti programming?

1259


Explain argument and its types.

1064


What is openmp in c?

1024