Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class test
- {
- static double F (double x)
- {
- x= (x/2)+3;
- return(x);
- }
- public static void main(String[] args)
- {
- char restart;
- double u , r;
- int n , L ;
- Scanner read = new Scanner(System.in);
- do
- {
- n=0;
- System.out.println("rentrez votre terme u0:");
- u = read.nextDouble();
- System.out.println("rentrez la limite");
- L = read.nextInt();
- System.out.println("rentrez votre incertitude");
- r = read.nextDouble();
- while( u<= L-r || u>=L+r)
- {
- u = F(u);
- n++;
- }
- System.out.println("Appartient Γ ]L-r ;L+r[" + "\n n: " + n+ "\n u: " +u);
- do
- {
- System.out.println("voulez vous recommencer y/n?");
- restart = read.next().charAt(0);
- }while (restart != 'y' && restart !='n' );
- }while (restart == 'y') ;
- System.out.println("Merci au revoir");
- read.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement