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

write a program to check whether a number is Peterson or not.

Answer Posted / deeksha shaw

import java.util.Scanner;
public class peterson
{
public static void main(String args[])
{
int n,f=1;
Scanner in=new Scanner(System.in);
System.out.println("enter a number");
n=in.nextInt();
for(int a=1;a<=n;a++)
f=f*a;
if (f==n)
System.out.println(" it is a Peterson number");
else
System.out.println("it is not a Peterson number");
}
}

Is This Answer Correct ?    11 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does c mean in standard form?

1185


What are actual arguments?

1099


What are the preprocessor categories?

1065


Explain what is wrong with this statement? Myname = ?robin?;

1589


Explain what is the use of a semicolon (;) at the end of every program statement?

1230


What is c mainly used for?

1066


Write a program to swap two numbers without using third variable?

1307


which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above

2065


How are strings stored in c?

1020


Define macros.

1279


What does emoji p mean?

1121


Explain spaghetti programming?

1259


What is "Hungarian Notation"?

1117


What is modifier & how many types of modifiers available in c?

1032


if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0

1952