Java program to find sum of 100 positive integers using 1 variable.
Answers
Answered by
0
Answer:
Using Java while Loop
public class SumOfNaturalNumber2.
{
public static void main(String[] args)
{
int num = 100, i = 1, sum = 0;
//executes until the condition returns true.
while(i <= num)
{
Answered by
0
Explanation:
import java.util.*
class p1
{
void read()
{
....
....
for(int a=1;a<=100;a++)
int s=s+a;
System.out.println (s);
}
}
Similar questions
Math,
2 months ago
English,
2 months ago
Social Sciences,
2 months ago
English,
5 months ago
Math,
11 months ago
Math,
11 months ago
Computer Science,
11 months ago