28 Septembre
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										18
									
								
								DEV1.1/TP05:Boucles/division.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								DEV1.1/TP05:Boucles/division.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int main() {
 | 
				
			||||||
 | 
						int n;
 | 
				
			||||||
 | 
						int m;
 | 
				
			||||||
 | 
						int i;
 | 
				
			||||||
 | 
						int r;
 | 
				
			||||||
 | 
						i=0;
 | 
				
			||||||
 | 
						printf("Veuillez saisir un entier positif ou nul suivit d'un entier strictement positif separer d'un espace: ");
 | 
				
			||||||
 | 
						scanf("%d",&n);
 | 
				
			||||||
 | 
						scanf(" %d",&m);
 | 
				
			||||||
 | 
						r=n;
 | 
				
			||||||
 | 
						while ((r-m)>0){
 | 
				
			||||||
 | 
							r=r-m;
 | 
				
			||||||
 | 
							i++;
 | 
				
			||||||
 | 
						} printf("%d = %d x %d + %d\n",n,i,m,r);
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										12
									
								
								DEV1.1/TP05:Boucles/filtrage.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								DEV1.1/TP05:Boucles/filtrage.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int main() {
 | 
				
			||||||
 | 
						float n;
 | 
				
			||||||
 | 
						printf("Veuillez saisir votre de bac.\n");
 | 
				
			||||||
 | 
						scanf("%f",&n);
 | 
				
			||||||
 | 
						while (n<0 || n>20){
 | 
				
			||||||
 | 
							printf("Erreur, la note n'est pas comprise entre 0 et 20, veuillez repeter.\n");
 | 
				
			||||||
 | 
							scanf("%f",&n);
 | 
				
			||||||
 | 
						} printf("Votre note au bac est de %.2f.\n",n);
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										22
									
								
								DEV1.1/TP05:Boucles/sequencedo.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								DEV1.1/TP05:Boucles/sequencedo.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int main() {
 | 
				
			||||||
 | 
					int n;
 | 
				
			||||||
 | 
					int m;
 | 
				
			||||||
 | 
					int i;
 | 
				
			||||||
 | 
					printf("Veuillez saisir 2 entiers separer d'un espace.\n");
 | 
				
			||||||
 | 
					scanf("%d",&n);
 | 
				
			||||||
 | 
					scanf(" %d",&m);
 | 
				
			||||||
 | 
					if (n>m){
 | 
				
			||||||
 | 
						do {
 | 
				
			||||||
 | 
							printf("%d\n",m);
 | 
				
			||||||
 | 
							m++;
 | 
				
			||||||
 | 
						} while (n>=m);
 | 
				
			||||||
 | 
					} else{
 | 
				
			||||||
 | 
						do {
 | 
				
			||||||
 | 
							printf("%d\n",n);
 | 
				
			||||||
 | 
							n++;
 | 
				
			||||||
 | 
						} while (m>=n);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										20
									
								
								DEV1.1/TP05:Boucles/sequencefor.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								DEV1.1/TP05:Boucles/sequencefor.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int main() {
 | 
				
			||||||
 | 
					int n;
 | 
				
			||||||
 | 
					int m;
 | 
				
			||||||
 | 
					int i;
 | 
				
			||||||
 | 
					printf("Veuillez saisir 2 entiers separer d'un espace.\n");
 | 
				
			||||||
 | 
					scanf("%d",&n);
 | 
				
			||||||
 | 
					scanf(" %d",&m);
 | 
				
			||||||
 | 
					if (n>m){
 | 
				
			||||||
 | 
						for (i=m;i<=n;i++){
 | 
				
			||||||
 | 
							printf("%d\n",i);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					} else{
 | 
				
			||||||
 | 
						for (i=n;i<=m;i++){
 | 
				
			||||||
 | 
							printf("%d\n",i);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										22
									
								
								DEV1.1/TP05:Boucles/sequencewhile.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								DEV1.1/TP05:Boucles/sequencewhile.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int main() {
 | 
				
			||||||
 | 
					int n;
 | 
				
			||||||
 | 
					int m;
 | 
				
			||||||
 | 
					int i;
 | 
				
			||||||
 | 
					printf("Veuillez saisir 2 entiers separer d'un espace.\n");
 | 
				
			||||||
 | 
					scanf("%d",&n);
 | 
				
			||||||
 | 
					scanf(" %d",&m);
 | 
				
			||||||
 | 
					if (n>m){
 | 
				
			||||||
 | 
						while (n>=m){
 | 
				
			||||||
 | 
							printf("%d\n",m);
 | 
				
			||||||
 | 
							m++;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					} else{
 | 
				
			||||||
 | 
						while (m>=n){
 | 
				
			||||||
 | 
							printf("%d\n",n);
 | 
				
			||||||
 | 
							n++;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										12
									
								
								DEV1.1/TP05:Boucles/table.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								DEV1.1/TP05:Boucles/table.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int main() {
 | 
				
			||||||
 | 
						int n;
 | 
				
			||||||
 | 
						int i;
 | 
				
			||||||
 | 
						printf("Veuillez saisir un entier: ");
 | 
				
			||||||
 | 
						scanf("%d",&n);
 | 
				
			||||||
 | 
						for (i=1;i<=10;i++){
 | 
				
			||||||
 | 
							printf("%d x %2d = %5d\n",n,i,i*n); //%2d permet l'alignement en colonnes en rajoutant des espaces si nécessaire au nombre de caractères saisient.
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user