-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExoS79.java
More file actions
30 lines (24 loc) · 979 Bytes
/
Copy pathExoS79.java
File metadata and controls
30 lines (24 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package exos.instructions;
import java.util.Scanner;
/**
* Exercice S79 : Chapitres
* Créer un programme qui permet d'afficher un nombre de chapitres et de sous-parties
* Le programme demandera le nombre de chapitres ainsi que le nombre de sous-parties à afficher
*/
public class ExoS79 {
public static void main(String[] args) {
int nbChap, nbSousPart;
Scanner scanner = new Scanner(System.in);
System.out.println("Entrez le nombre de chapitres :");
nbChap = scanner.nextInt();
System.out.println("Entrez le nombre de sous-chapitres :");
nbSousPart = scanner.nextInt();
for (int numChap = 1 ; numChap <= nbChap ; numChap++) {
System.out.println("Chapitre " + numChap);
for (int numSousPart = 1 ; numSousPart <= nbSousPart ; numSousPart++) {
System.out.println("\tSous-partie " + numChap + "." + numSousPart);
}
}
scanner.close();
}
}