Skip to content

Instantly share code, notes, and snippets.

@canokay
Last active November 15, 2018 08:31
Show Gist options
  • Save canokay/1e7ddd4a0156042862eb236519f525f6 to your computer and use it in GitHub Desktop.
Save canokay/1e7ddd4a0156042862eb236519f525f6 to your computer and use it in GitHub Desktop.
Java While Example
import java.util.Scanner;
public class WhileExample {
public static void main(String[] args) {
int toplam=0;
System.out.println("Lütfen 5 sayi giriniz: ");
Scanner s=new Scanner(System.in);
int i=1;
while (i<6) {
System.out.println(i+". sayiyi giriniz: ");
int sayi=s.nextInt();
toplam+=sayi;
i++;
}
System.out.println("Girdiginiz sayilarin toplami = "+toplam);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment