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

Explain what header files do I need in order to define the standard library functions I use?

1128


int far *near * p; means

3512


Can we access the array using a pointer in c language?

1004


What is a constant and types of constants in c?

1077


How to declare pointer variables?

1178


Do pointers need to be initialized?

1036


write a program fibonacci series and palindrome program in c

984


Write a program with dynamically allocation of variable.

1080


Explain how can I remove the trailing spaces from a string?

1002


Which is best book for data structures in c?

1052


Explain 'far' and 'near' pointers in c.

1093


What are the restrictions of a modulus operator?

1070


Explain c preprocessor?

1055


Explain the difference between call by value and call by reference in c language?

1063


‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.

2304