EXERCICE II
Programmes linéaires, type des
données, entrée/sortie
void main (void ) {
int i
= 23674;
int j = -23674;
long k = (1L << 31);
printf ("impression
de i : \n");
printf ("|%d| \t |%u|
\t |%o| \t |%x|" ,i,i,i,i) ;
printf ("\n|%10d| \t
|%10.6d| \t |%-10.3o| \t |%.5x|" ,i,i,i,i) ;
printf ("\nimpression de
j : \n");
printf("%d \t %u \t %o \t %x",j,j,j,j);
printf ("\nimpression de
k: \n") ;
printf ("%ld \t %lu \t %lo \t %lx", k, k,
k,k) ;
printf ("\n");
}
void main (void){
float a,b,c;
int
i,j,k ;
int
l1,l2,l3 ;
char ch1,ch2,ch3;
double x = 1e-8 +
1000;
char ch4 = 'A' ;
char *chaine = "chaine de caracteres" ;
a
= 3.54; b = 8.45; ch1 = '+';
ch2 = '-';
i = 12; j= 7; k = 3;
printf
("b=%e c= %10.3f i = %d j= %d k= %d
ch1= %c ch2= %c ch3= %c\n",
b,c,i,j,k,ch1,ch2,ch3);
printf("a%cb=%8.2f\n",ch1,a+b);
printf("i/(float)j=%8.2f\n", i/j);
printf("i / j=%d\n", i / j);
printf("i %% j=%d\n", i % j);
printf("k>2 est %d\n", k>2);
printf("
a>2 && a<5 est %s\n", a>2
&& a<5 ?"TRUE":"FALSE");
printf
( "(a<2 || a>5) est %s\n",a>2
|| a<5 ?"TRUE":"FALSE");
}
#include <stdio.h>
void main()
{ int a,p,s;
printf("Entrer a=");
scanf("%d",&a);
s=a*a;
p=4*a;
printf("Surface s=%d\n",s);
printf("Périmetre
p=%d\n",p);
}
Page précédente Page suivante Sommaire