a program to print prime numbers up to 100 using for loop in java

Duplicated posts. Topics merged

Page 1 of 1

13 Replies - 11095 Views - Last Post: 10 February 2009 - 03:32 AM Rate Topic: -----

#1 dirtydevil  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 22-January 09

a program to print prime numbers up to 100 using for loop in java

Post icon  Posted 22 January 2009 - 05:29 AM

a program to print prime numbers up to 100 using for loop in java

This post has been edited by pbl: 22 January 2009 - 05:18 PM

Is This A Good Question/Topic? 0
  • +

Replies To: a program to print prime numbers up to 100 using for loop in java

#2 dirtydevil  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 22-January 09

Re: a program to print prime numbers up to 100 using for loop in java

Post icon  Posted 22 January 2009 - 05:32 AM

1. Write a program to calculate the area of a circle using circle class
2. Write a program to generate Fibonacci series for first 100 numbers
3. Write a program to input an alphabet and check whether it is a vowel or consonant using switch.
4. Write a program that guarantees 25 random int values. For each value, use an if-else statement to classify it is greater than, less than or equal to a second randomly generated value.
5. Write a program to print prime numbers up to 100 using for loop.
6. Write a program to calculate the factorial of n numbers using while loop.
7. Write a program to check a given word is a palindrome or not
8. Write a program to find the smallest and largest from a given set of numbers.
9. Write a program computes the maximum, minimum, and average of n real numbers.
10. Write a Program to find the sum of all numbers between 3 and 60.
11.

Write a program that computes the square root of the number say
The program can also be called with multiple arguments, so that each will have its square root calculated, as in:

sqrt 2 3 4 5

which will return the output:

SQRT(2) = 1.41421

SQRT(3) = 1.73205

SQRT(4) = 2

SQRT(5) = 2.23607
12. Write a program that does Temperature Conversion Using While loop.
13. Write a program to draw basic shapes like circles, ovals, lines, arcs, squares, rectangles, rounded rectangles, and polygons using applets. Fill the shapes with different colours.
14. Write a program to draw a simple text by defining style, font, size and colour. Try it for various dimensions by changing font, size, colour etc.
15. Write a program to read an image and display an image
OOP
Was This Post Helpful? 0
  • +
  • -

#3 epper  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 20-January 09

Re: a program to print prime numbers up to 100 using for loop in java

Posted 22 January 2009 - 05:42 AM

Show some code to show us what you have. If you have none for a loop to find prime numbers I recommend using the % operator and only test up to half the original number your testing.
Was This Post Helpful? 0
  • +
  • -

#4 iimememine  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 20
  • Joined: 22-July 08

Re: a program to print prime numbers up to 100 using for loop in java

Posted 22 January 2009 - 06:12 AM

I don't think you typed "a program to print prime numbers up to 100 using for loop in java" enough times to get a helpful response.

It could be something else though.

[rules][/rules]
Was This Post Helpful? 0
  • +
  • -

#5 Gloin  Icon User is offline

  • Expert Schmexpert...
  • member icon

Reputation: 235
  • View blog
  • Posts: 4,489
  • Joined: 04-August 08

Re: a program to print prime numbers up to 100 using for loop in java

Posted 22 January 2009 - 07:41 AM

These are all good exercises. Primes are commonly found using the Sieve of Eratosthenes.

[rules][/rules]

By the way, this is not classified as Intermediate, this is definitely beginner stuff.

This post has been edited by Gloin: 22 January 2009 - 07:42 AM

Was This Post Helpful? 0
  • +
  • -

#6 mostyfriedman  Icon User is offline

  • The Algorithmi
  • member icon

Reputation: 725
  • View blog
  • Posts: 4,471
  • Joined: 24-October 08

Re: a program to print prime numbers up to 100 using for loop in java

Posted 22 January 2009 - 08:07 AM

you gotta be kidding me
Was This Post Helpful? 0
  • +
  • -

#7 ayman_mastermind  Icon User is offline

  • human.setType("geek");
  • member icon

Reputation: 126
  • View blog
  • Posts: 1,860
  • Joined: 12-December 08

Re: a program to print prime numbers up to 100 using for loop in java

Posted 22 January 2009 - 08:15 AM

@dirtydevil, dont expect from us to solve all your homework for you... just be specific in your question, show your effort and code... thanks good luck...
Was This Post Helpful? 0
  • +
  • -

#8 BigAnt  Icon User is offline

  • May Your Swords Stay Sharp
  • member icon

Reputation: 101
  • View blog
  • Posts: 2,392
  • Joined: 16-August 08

Re: a program to print prime numbers up to 100 using for loop in java

Posted 22 January 2009 - 08:18 AM

So you just decide and post your list of assignments and expect code in return.

NO!!!! :angry: :angry: :angry: :angry:

DIC requires good faith effort on your part towards solutions to the problems you have.
Was This Post Helpful? 1

#9 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8315
  • View blog
  • Posts: 31,836
  • Joined: 06-March 08

Re: a program to print prime numbers up to 100 using for loop in java

Posted 22 January 2009 - 05:15 PM

An you qualify this post as "Intermediate" ???
All your programs are really beginners stuff

And avoid double posting :angry: :angry:

Topics merged
Was This Post Helpful? 1

#10 priya_lorha  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 78
  • Joined: 02-August 08

Re: a program to print prime numbers up to 100 using for loop in java

Posted 22 January 2009 - 09:06 PM

So you just decide and post your list of assignments and expect code in return.

NO!!!! :crazy: :crazy: :angry: :angry: :angry: :angry: :angry:
Was This Post Helpful? 0
  • +
  • -

#12 priya_lorha  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 78
  • Joined: 02-August 08

Re: a program to print prime numbers up to 100 using for loop in java

Posted 22 January 2009 - 09:27 PM

To check for prime nos u need to divide the nos frm 1 to the nos and check for the remainder....... like
int i=100;
int c=0;
while(i>=100)
{ for(int j=1;j<i;j++)
{ if(i%j==0)
 c++;
if(c<=2)
System.out.println(i);
i++;
}
}

//calculate the area of a circle using circle class
int area;
int radius;
radius=Integer.parse.Int(in.readLine());
area=3.14*radius* radius;
System.out.println(radius);

//. Write a program to input an alphabet and check whether it is a vowel or consonant using switch.
enter the alphabet use
like
char a;
if(a=='a'||a=='e')(this process till U),use ignore case and compare it if the vowel test fails.. Its a constant

Write a program to generate Fibonacci series for first 100 numbers
use a counter vich will run from 0 to 99,and will break after 99 and print the output.Initalize 3 varibles... one will store the value 0 ,2nd one will store the value 1 third one wil store the sum;
store the value of 2nd variable in the first
then store the 3rd variable value in 2nd one ...and print the output.

//calculate the factorial of n
use loop that vil go frm 1-n, and calculate the factorial..
// given word is a palindrome
use reverse fx to chk for palindrome. and
Was This Post Helpful? 1

#13 KiraBitoy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 23-November 08

Re: a program to print prime numbers up to 100 using for loop in java

Posted 04 February 2009 - 05:17 PM

dirtydevil.....errrrmmm..where's your code?
Was This Post Helpful? 0
  • +
  • -

#14 prajayshetty  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 31
  • View blog
  • Posts: 920
  • Joined: 27-April 07

Re: a program to print prime numbers up to 100 using for loop in java

Posted 10 February 2009 - 03:30 AM

no one is gonna write the code for you in java even i was not helped by the dic they are doing right if we dont intiate something they will not help this site only meant to help those who show that they are also trying and i think this looks like a college assignment and they are not meant to be copied but trying it by yourself
Was This Post Helpful? 0
  • +
  • -

#15 no2pencil  Icon User is offline

  • Head MFIC
  • member icon

Reputation: 5062
  • View blog
  • Posts: 26,437
  • Joined: 10-May 07

Re: a program to print prime numbers up to 100 using for loop in java

Posted 10 February 2009 - 03:32 AM

I think he gets the idea of the rules... Topic Closed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1