Untitled
unknown
plain_text
2 years ago
449 B
7
Indexable
/**
* prints set of numbers with for and while loops
*
* @author Amanda Cui
* @version 11/14/23
*/
public class NestedPractice3{
public static void main(String[] args){
int i=1;
int sum=0;
while(i<=100){
for(int k=1;k<=i;k++){
sum+=i;
}
i++;
System.out.println("The sum of positive integers from 1 to "+i+"is "+sum);
}
}
}Editor is loading...
Leave a Comment