answersLogoWhite

0


Best Answer

you can use the condition statement like for(i=0:i<=10;i++)

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

public class Sum {

public static void main(String[] args) {

int sum=0;

for(int i=1; i<=10; i++)

sum+=i;

System.out.println(sum);

}

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you Write a java program that computes the sum of the first ten postive integers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you write a c program that computes results of 10 students for any given 4 subjects grading their results from a A to U?

ghfj


Write a program in C programming language that computes the roots of the quadratic equation ax2 plus bx plus c?

Write your program and if you are having a problem post it here with a description of the problem you are having. What you are asking is for someone to do your homework for you.


Write a program in c that prompt user with following lines add two integers test an integer for odd or even and quit?

write a program in C that prompts the user with the following lines: a) Add two integers c) Compare two integers for the larger t) Test an integers for odd or even q) Quit


Writes a c program to find the sum of all integers between 1 and n?

Write a program to find the number and sum of all integers from 100 to 300 that are divisible by 11


Write a c plus plus program to compute two integers?

int x= 1; int y= 2;


Write a statementin a java program to read 2 integers and dispay the number of interagers between them?

a=153 a=n%10;


Implement a short C program that works with factorization of integers you will write C program that computes and prints out the sum of all natural numbers below 100000 that are multiples of 3or 5 or7?

#include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main() { int i=1,sum=0; clrscr(); while(i&lt;10000) { if((i%3==0)(i%5==0)(i%7==0)) { sum=sum+i; } i++; } printf("\nThe sum is%d",sum); getch(); }


Write an expression that computes the sum of the two variables verbalScore and mathScore?

totalScore = verbalScore mathScore


Write a program in C for arithmetic operations between two integers your program should guide users with proper message or menu on the console?

Write a program in C for showing working of different logical operator in C.Your program should guide users with proper message/menu on the console. (5 Marks)


Write a program in pascal that declares two integers and gives there sum?

This is not a question so you do not need to use a question mark at the end of your sentence.


Write a c program to find GCD of two given integers by using both recursive n non recursive functions?

i love u darling


Write a c program for 50 positive integers that are divisible by 7?

#include&lt;stdio.h&gt; main() { int i; for(i=1;i&lt;=50;i++) { if (i%5!=0) printf("\n %d",i); } }