Complete IIT AIEEE ICSE ISC PMT help forum
This is a free help Forum for Indian Students.
Complete IIT AIEEE ICSE ISC PMT help forum
This is a free help Forum for Indian Students.
Complete IIT AIEEE ICSE ISC PMT help forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Complete IIT AIEEE ICSE ISC PMT help forum

Complete help forum for students preparing for icse iit aieee cbse pmt and other related exams.Stay updated about all 2011 exams.
 
HomeHome  PortalPortal  SearchSearch  Latest imagesLatest images  RegisterRegister  Log in  India NewsIndia News  
Keywords
CASE UNION question physics RESULT computer 2004 ICSE graph papers YEAR CLASS SELECT prelim 2010 2007 2009 paper 2006 science
Latest topics
» Nitration of aniline - IIT JEE 2018 Advanced - solved
ans this. EmptyFri Jun 08, 2018 2:34 am by adianadiadi

» Diamagnetic - Paramagnetic - Ni(CO)4, [Ni(CN)4]2- and [NiCl4
ans this. EmptyFri Apr 06, 2018 1:05 am by adianadiadi

» IIT JEE chemistry solved interactive question paper
ans this. EmptySun Oct 29, 2017 12:11 pm by adianadiadi

» IIT JEE 2015 SOLVED QUESTION PAPER
ans this. EmptyWed Oct 19, 2016 1:44 pm by adianadiadi

» IIT JEE chemistry solved questions
ans this. EmptySat Jul 18, 2015 6:15 pm by adianadiadi

» General Description of Chinese Market for Foaming Agent ADC
ans this. EmptyFri May 09, 2014 2:09 pm by happybaicaitou

» How to get Lowest Cost MBBS Admission?
ans this. EmptyMon Feb 24, 2014 6:39 pm by MENTOR 2014

»  girl boy vashikaran specialist agori baba ji +91-9461165
ans this. EmptyTue Jan 21, 2014 6:00 pm by krshastri

»  STRONG LOST LOVE SPELL +91-9461165176
ans this. EmptyTue Jan 21, 2014 6:00 pm by krshastri

Top posters
abhas
ans this. Vote_lcapans this. Voting_barans this. Vote_rcap 
Anu..i luv icse...:)
ans this. Vote_lcapans this. Voting_barans this. Vote_rcap 
G-7
ans this. Vote_lcapans this. Voting_barans this. Vote_rcap 
siya
ans this. Vote_lcapans this. Voting_barans this. Vote_rcap 
Candy
ans this. Vote_lcapans this. Voting_barans this. Vote_rcap 
jOhNy
ans this. Vote_lcapans this. Voting_barans this. Vote_rcap 
Apurva
ans this. Vote_lcapans this. Voting_barans this. Vote_rcap 
WinRrule
ans this. Vote_lcapans this. Voting_barans this. Vote_rcap 
ambili
ans this. Vote_lcapans this. Voting_barans this. Vote_rcap 
saif
ans this. Vote_lcapans this. Voting_barans this. Vote_rcap 



Search if you can't find it here

ans this.

View previous topic View next topic Go down
AuthorMessage
Hari
Active member
Active member
Hari


ans this. Vide
PostSubject: ans this. ans this. EmptyMon Feb 23, 2009 4:35 pm

hi...

1.....please give me the java code tovfind primorialof a number...............

primorial of n is product of prime nos below or equal to n.

eg: primorial of is 2*3*5 which is 30

2.......write whether a nuimber is armstrong like.....

eg: 165033 is 16^3 + 50^3 + 33^3
Back to top Go down
Anu..i luv icse...:)
Active member
Active member
Anu..i luv icse...:)


ans this. Vide
PostSubject: Re: ans this. ans this. EmptyMon Feb 23, 2009 8:19 pm

1)

import java.io.*;
class prim
{
int prime=0,sum=1;
public void pp(int num)
{
for(int j=2;j<=num/2;j++)
{
if(num!=j)
{
if(num%j!=0)
{
prime=0;
}
else if(num%j==0)
{
prime=1;
}
}
}
}

public void ans(int n)
{
for(int i=2;i<=n;i++)
{
pp(i);
if(prime==0)
{
sum=sum*i;
System.out.println(i+" is Prime");
}
else
System.out.println(i+"is not prime");
}
System.out.println("Primorial of "+n+" is "+sum);
}
}


NOTE:

the first method pp() is to find whether a num is prime or not

the second method ans() is to find the prime nums till n and then find their product.

OUTPUT:

if n=5: output is:

2 is Prime
3 is Prime
4is not prime
5 is Prime
Primorial of 5 is 30


hope you understood
Back to top Go down
Anu..i luv icse...:)
Active member
Active member
Anu..i luv icse...:)


ans this. Vide
PostSubject: Re: ans this. ans this. EmptyMon Feb 23, 2009 8:24 pm

hey amstrong num is a number whose sum of the cubes of its digits is equal to the number itself.
Back to top Go down
Anu..i luv icse...:)
Active member
Active member
Anu..i luv icse...:)


ans this. Vide
PostSubject: Re: ans this. ans this. EmptyTue Feb 24, 2009 1:28 am

arrey..no reply?
Back to top Go down
Apurva
Active member
Active member
Apurva


ans this. Vide
PostSubject: Re: ans this. ans this. EmptyTue Feb 24, 2009 1:31 am

yes anu ur rite
dats armstrong
bt no need 2 wry if in icse dey give ny such question den they vry well explin wt it is
Back to top Go down
siya
Active member
Active member
siya


ans this. Vide
PostSubject: Re: ans this. ans this. EmptyTue Feb 24, 2009 2:15 am

yeah apurva is rite...
Back to top Go down
Hari
Active member
Active member
Hari


ans this. Vide
PostSubject: Re: ans this. ans this. EmptyTue Feb 24, 2009 11:43 am

so please give aprogram for armstrong nos
Back to top Go down
akshay
Active member
Active member



ans this. Vide
PostSubject: Re: ans this. ans this. EmptyTue Feb 24, 2009 11:54 am

import java.io.*;
class armstrongno
{
public static void main() throws IOException
{
DataInputStream in = new DataInputStream (System.in);
System.out.println("enter no.");
int n =Integer.parseInt(in.readLine());
int i =n;
int sum=0;
int k;
while (i!=0)
{
k = i%10;
sum = sum+(k*k*k);
i = i/10;
}
if (sum==n)
System.out.println(n+" is an armstrong no.");
else
System.out.println(n+" is not an armstrong no.");
}}
Back to top Go down
akshay
Active member
Active member



ans this. Vide
PostSubject: Re: ans this. ans this. EmptyTue Feb 24, 2009 11:56 am

pls check if it comes =)
Back to top Go down
Hari
Active member
Active member
Hari


ans this. Vide
PostSubject: Re: ans this. ans this. EmptyTue Feb 24, 2009 12:13 pm

as-24 it didnt works...its sayin 165033 not armstrong
Back to top Go down
Namit
Active member
Active member
Namit


ans this. Vide
PostSubject: Re: ans this. ans this. EmptyTue Feb 24, 2009 1:10 pm

mport java.io.*;
class armstrongno
{
public static void main() throws IOException
{
DataInputStream in = new DataInputStream (System.in);
System.out.println("enter no.");
int num =Integer.parseInt(in.readLine());int num1=num,sum=0,rem=0;while(num1>0){rem=num1%10;sum=sum+(int)(Math.pow(rem,3));num1=num1/10;}if(sum==num){System.out.println("armstrong");elseSystem.out.println(" Not Armstrong");}}
Back to top Go down
Anu..i luv icse...:)
Active member
Active member
Anu..i luv icse...:)


ans this. Vide
PostSubject: Re: ans this. ans this. EmptyTue Feb 24, 2009 1:37 pm

hey 165033=1^3 + 6^3 + 5^3 + 3^3 + 3^3
= 1+216+125+9+9
!= 360

so, 165033 is nt amstrong num hari.
Back to top Go down
Namit
Active member
Active member
Namit


ans this. Vide
PostSubject: Re: ans this. ans this. EmptyTue Feb 24, 2009 1:41 pm

my dear friend hari..
da code is absolutely crct..an armstrong number is one, da sum of da cubes of invidual digits of which is qual to the number itself          Ex:153           1^3+5^3+3^3=1+125+27=158         bt 165033 is nt armstrong              1^3+6^3+5^3+0^3+3^3+3^3=1+216+125+0+27+27=360      hope u get it..  Smile  
Back to top Go down
akshay
Active member
Active member



ans this. Vide
PostSubject: Re: ans this. ans this. EmptyTue Feb 24, 2009 2:06 pm

try no. 371, it'll come
Back to top Go down
pranjain




ans this. Vide
PostSubject: Re: ans this. ans this. EmptyThu Dec 31, 2009 1:29 pm

THANK YOU ALL cheers bounce lol!
Back to top Go down
Sponsored content




ans this. Vide
PostSubject: Re: ans this. ans this. Empty

Back to top Go down

ans this.

View previous topic View next topic Back to top
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Complete IIT AIEEE ICSE ISC PMT help forum :: Computer :: Computer help forum-