Add inversion-variables
This commit is contained in:
parent
94afcf9bc9
commit
3e73a20ee6
2 changed files with 26 additions and 3 deletions
|
@ -1,7 +1,10 @@
|
|||
all: convertisseur-devises
|
||||
all: convertisseur-devises inversion-variables
|
||||
|
||||
convertisseur-devises: convertisseur-devises.c
|
||||
gcc convertisseur-devises.c -o convertisseur-devises
|
||||
cc convertisseur-devises.c -o convertisseur-devises
|
||||
|
||||
inversion-variables: inversion-variables.c
|
||||
cc inversion-variables.c -o inversion-variables
|
||||
|
||||
clean:
|
||||
rm -f convertisseur-devises
|
||||
rm -f convertisseur-devises inversion-variables
|
||||
|
|
20
programmation-c-cpp/tp1/inversion-variables.c
Normal file
20
programmation-c-cpp/tp1/inversion-variables.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
/* Inversion de variables */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main() {
|
||||
int tmp;
|
||||
int var1 = 123;
|
||||
int var2 = 18;
|
||||
|
||||
printf("var1=%d et var2=%d\n", var1, var2);
|
||||
|
||||
tmp = var1;
|
||||
var1 = var2;
|
||||
var2 = tmp;
|
||||
|
||||
printf("var1=%d et var2=%d\n", var1, var2);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue