Advertisement
Tecnelm

Untitled

Sep 29th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Exercice5 {
  4.  
  5.     public static void main(String[] args)
  6.     {
  7.         char restart ;
  8.         long  n ,  result ;
  9.         Scanner read = new Scanner (System.in);
  10.         do
  11.         {
  12.             System.out.println("rentrez votre n");
  13.             n= read.nextInt();
  14.             result = 0;
  15.             for (int i =1 ; i<= n ; i++)
  16.             {
  17.                 result += i ;
  18.                 System.out.println(result);
  19.                 result*=Math.pow(10,((i+1)/10)+1);
  20.             }
  21.             do
  22.             {
  23.                 System.out.println("voulez vous recommencer y/n?");
  24.                 restart = read.next().charAt(0);
  25.             }while (restart != 'y' && restart !='n' );
  26.         }while (restart == 'y') ;
  27.         System.out.println("Merci au revoir");
  28.         read.close();
  29.  
  30.     }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement