# i dont no how to solve it pls

Manan Ayob
i dont no how to solve it pls
2 Answer(s)      6 years and 9 months ago
Posted in : Java Interview Questions

Calculate and display the sum of all prime number from 1 to 100 covert in java system codes

December 15, 2010 at 3:38 PM

Hi Friend,

Try the following code:

```class PrimeNumbers{
public static void main (String args[]){
String primeNo = "";
int sum=0;
int j=0;
System.out.println("Prime nums are:" );
for (int i = 1; i < 100; i++){ {
for ( j = 2; j < i; j++){
if (i % j == 0) {
break;
}
}
if (i == j) {
primeNo += i + " ";
sum+=i;
}
}
}
System.out.println(primeNo);
System.out.println("Sum of Prime Numbers: "+sum);
}
}
```

Thanks

December 27, 2010 at 4:54 PM

Hi friend Try this code.......

```import java.io.;
class today2
{
public static void main(String args[])throws IOException
{
int num=Integer.parseInt(str);
int sum=0;
//int  test=5;
for(int i=2;i&lt;=num;i++)
{
if(num%i==0)
{
sum=sum+i;
}
}
System.out.println("Result"+sum);
}
}
```

i dont no how to solve it pls
i dont no how to solve it pls   Calculate and display the sum of all prime number from 1 to 100 covert in java system codes
PureStack question---i dont know how to do this
PureStack question---i dont know how to do this  Write a stack class ArrayStack.java implements PureStack interface that reads in strings from... the queue g. H and I join the queue h. G leaves the queue i. H and I leave
PureStack question---i dont know how to do this
PureStack question---i dont know how to do this  Write a stack class ArrayStack.java implements PureStack interface that reads in strings from... the queue g. H and I join the queue h. G leaves the queue i. H and I leave
how do i solve this problem?
how do i solve this problem?  Define a class named Circle with the following properties: List item An integer data field named radius with protected access modifier, and a String data field named colour with private access
how do i solve this question?
how do i solve this question?  1.Define a class named Circle with the following properties: a) An integer data field named radius with protected access modifier, and a String data field named colour with private access modifier
how should i can solve
how should i can solve  Web based program - Input - Person's contact details with Passport Number as Unique Key. Save data in to oracle / MySQL. Output - List of Persons saved in the database. Technology to be used - JSP
one error but i dont know how to fix it o_O!!!
one error but i dont know how to fix it o_O!!!  where is the mistake here ?? import java.utill.Scanner; public class Time { public static void main (String [] args) { Scanner keyboard = new Scanner (System.in
how can i get output pls urget tell me
how can i get output pls urget tell me  HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception
how to solve
how to solve   log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources). log4j:WARN Please initialize the log4j system properly
how to solve this..
how to solve this..  Given a list of students and their marks Name | Science | Math | English | Computer Ahmad | 28 | 100 | 66 | 34 Samad | 56 | 89 | 55
how to solve this..
how to solve this..  Given a list of students and their marks Name | Science | Math | English | Computer Ahmad | 28 | 100 | 66 | 34 Samad | 56 | 89 | 55
I couldn't solve it
I couldn't solve it  *A customer who wants to apply for getting a car license should provide information about the brand of the car. *Then the customer receives a request ID from the office. *The customer's request (represented
i need help to solve this problem
i need help to solve this problem  Write a stack class ArrayStack.java implements PureStack interface that reads in strings from standard input.... H and I join the queue h. G leaves the queue i. H and I leave the queue
pls i need help with my assignment
pls i need help with my assignment  how to write a code that ask the user for the height of the triangle and prints the triangle using * eg if height is 3 it prints * and also using import java.util.Scanner
how to solve an internet connection problem
how to solve an internet connection problem  when i run my..." java.lang.UnsupportedOperationException: Not yet implemented the problem is that i don`t know how to implement
How to solve the Hibernate Common Exceptions?
How to solve the Hibernate Common Exceptions?  How to solve the Hibernate Common Exceptions
How to Solve the Syntax Error in java??
How to Solve the Syntax Error in java??  Syntax error in java? i have... on token "i", VariableDeclarator expected after this token" . in last line of the program "objectname.i" What is the reason for this error??How to access the variable
how to solve this problem for oracle connectivity
how to solve this problem for oracle connectivity  Exception in thread "main" java.sql.SQLException: Io exception: The Network Adap ter could not establish the connection
Solve it
Solve it  How to calculate the value which contains oparator and operand both using command line argument
how to solve the nullPointer Exception in main - Java Beginners
how to solve the nullPointer Exception in main  New to Java ,pls help me how fix Null pointer Exception in main: two files , split .java another is actualState1.java , I want to get value of spaceWord[1] from split.java
how to solve 'Stop Running This Script' Error ?
how to solve 'Stop Running This Script' Error ?  Hi.. When opened the page on IE browser(version : 8.0),it gives an java script error (i.e.Stop Running This Script). I have used jsp/servlet for this. Please help to resolved
how to solve this kind of error in Eclipse IDE?
how to solve this kind of error in Eclipse IDE?   i'm creating the Simple CRUD Using Jsp, Servlet and MySQL program and i'm using the eclipse, and i all most done it, finally i'm going to run myself, it can't be run. i
Small Bug How to solve in my code
Small Bug How to solve in my code  String season=""; pst = con.prepareStatement("SELECT DISTINCT(Season) season FROM specialdates where Regid...") + ","; it shows bug in findbugs tool.. but it executes successfully how to solve
hi.. i hv few error. pls. - Java Beginners
hi.. i hv few error. pls.  hi sir, i have few error. can u pls help me. pls. im very new in java. ths my Uni assgmnt. please help me... import...(""); System.out.println("\t "+title[i]+"\t
i have a problem to do this question...pls help me..
i have a problem to do this question...pls help me..  Write a program... reversedNumber = 0; for (int i = 0; i <= num; i...; reversedNumber = reversedNumber * 10 + r; i = 0
How to solve button problem - Java Beginners
How to solve button problem  I have created button (Open File Dialog) , List, JTabbedpane and MenuBar . By clicking btnBrowse button I am getting... GridLayout for showing image files because if I use other Layouts image files
solve this pbm
solve this pbm  sir rows are also inserting i have checked in the database also the rows are not affected in the table . The first pbm wich i have sent to you is not yet solved.......... pls give me detail explaination how we
solve this
solve this   Create a student class. The student object should have studentid, studentname, subject and marks as properties. Also generate the getter and setter methods. Create 5 objects of this class and populate values
i want to retriev and update in same form but its not working pls help....
i want to retriev and update in same form but its not working pls help....  <p><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html></p> <p>
how to make a matrix like datagrid in ide in java pls help
how to make a matrix like datagrid in ide in java pls help  how to make a datagrid mainly matrix in ajava standalone app
Want to add a resource in the build directory that's created when i run an mvn assembly:assembly command. Pls help!
Want to add a resource in the build directory that's created when i run an mvn assembly:assembly command. Pls help!  I have got a certificate in my resource folder-> src/main/resources/cacerts. When I do a mvn assembly