rrr
This commit is contained in:
parent
1765a453cf
commit
1c467cd9cd
72
DEV1.1/TP16/Découpage.c
Normal file
72
DEV1.1/TP16/Découpage.c
Normal file
@ -0,0 +1,72 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int i;
|
||||
int j;
|
||||
int hauteur;
|
||||
|
||||
|
||||
char triangle(hauteur){
|
||||
for(i=0;i<=hauteur; i++){
|
||||
for(j=1;j<=i;j++){
|
||||
printf("*");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
char carre(hauteur){
|
||||
for(i=1; i<=hauteur; i++){
|
||||
if(i==1 || i== hauteur){
|
||||
for(j=1; j<=hauteur; j++){
|
||||
printf("*");
|
||||
}
|
||||
}
|
||||
else{
|
||||
for(j=1; j<=hauteur; j++){
|
||||
if (j==1 || j == hauteur){
|
||||
printf("*");
|
||||
}
|
||||
else{
|
||||
printf(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(void){
|
||||
char choix;
|
||||
do{
|
||||
int i=0;
|
||||
int j=i;
|
||||
int largeur;
|
||||
printf("_____________\n");
|
||||
printf("t) Triangle\n");
|
||||
printf("c) Carré\n");
|
||||
printf("q) Quitter\n");
|
||||
printf("Votre choix ? ");
|
||||
scanf(" %c", &choix);
|
||||
printf("\n");
|
||||
if(choix=='t'){
|
||||
printf("Hauteur ? ");
|
||||
scanf("%d", &hauteur);
|
||||
triangle(hauteur);
|
||||
}
|
||||
if(choix=='c'){
|
||||
printf("Hauteur ? ");
|
||||
scanf("%d", &hauteur);
|
||||
carre(hauteur);
|
||||
}
|
||||
if(choix=='q'){
|
||||
printf("\n");
|
||||
printf("Au revoir !\n");
|
||||
}
|
||||
}while(choix!='q');
|
||||
}
|
0
DEV1.1/TP16/miroir.c
Normal file
0
DEV1.1/TP16/miroir.c
Normal file
16
DEV1.1/TP17/doubleur.c
Normal file
16
DEV1.1/TP17/doubleur.c
Normal file
@ -0,0 +1,16 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int somme(int n, int m) {
|
||||
return n+m;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
int valeur;
|
||||
int* p = NULL;
|
||||
printf("Entrez un entier : ");
|
||||
scanf("%d", p);
|
||||
|
||||
printf("Le double vaut %d\n", somme(*p, *p));
|
||||
return EXIT_SUCCESS;
|
||||
}
|
20
DEV1.1/TP17/envers.c
Normal file
20
DEV1.1/TP17/envers.c
Normal file
@ -0,0 +1,20 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void envers(const char texte[]) {
|
||||
unsigned position;
|
||||
for(position = strlen(texte)-1; position >= 0; position--) {
|
||||
printf("%c", texte[position]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if (argc < 2) {
|
||||
printf("usage : %s <texte>\n", argv[0]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
envers(argv[1]);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Loading…
Reference in New Issue
Block a user