8.3.. Saberi prirodne brojeve do 100.
Opis rješenja:
Opis programa:
Listing programa:
package zadatak;
import java.util.Scanner;
public class 08311015
{
public static void main(String[] args){
Scanner input = new Scanner (System.in);
int i=1;
double s=0;
do
{
s=s+i;
i++;
} while (i<=100);
System.out.println("Suma brojeva do 100 je: " + s);
}
}
Ispis na ekranu:
Index
|