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
English,
1 month ago
English,
3 months ago
Math,
9 months ago
Math,
9 months ago
Computer Science,
9 months ago