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 is a lookup table in c?

1120


to print the salary of an employee according to follwing calculation: Allowances:HRA-20% of BASIC,DA-45% of BASIC,TA-10%. Deductions:EPF-8% of BASIC,LIC-Rs.200/-Prof.Tax:Rs.200/- create c language program?

2178


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

1583


Explain what will be the outcome of the following conditional statement if the value of variable s is 10?

1248


What is || operator and how does it function in a program?

1087


What kind of structure is a house?

1042


What is scope rule in c?

1062


What is the difference between functions getch() and getche()?

1096


Why is extern used in c?

1091


What are dangling pointers? How are dangling pointers different from memory leaks?

1310


Explain modulus operator.

1054


printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions

1157


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

1056


Can i use “int” data type to store the value 32768? Why?

1187


the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function

1313