Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Section E

Séance 1 – de 8:30 à 9:30 --------------------------------------------------------------------------------------

Exercise 1. Write a C program that displays even integers between 1 and 80.

Exercise 2. Run the following program:

#include<stdio.h>
void main() {
int T[5]={7,-5, 0,34,2};
int nb_positifs, i;
nb_positifs=0;
for (i = 0; i < 5; i++)
{
if (T[i] > 0)
nb_positifs++;
}
printf("\n nb_positifs=%d",nb_positifs);
}
Séance 2 – de 9:30 à 10:30 --------------------------------------------------------------------------------------

Exercise 1. Write a C program that displays the product of integers and stops when the value 0 is
entered.

Exercise 2. Run the following program:

#include<stdio.h>
void main() {
int T[5]={11,0, 52,0,-1};
int nb_null, i;
nb_null=0;
for (i = 0; i < 5; i++)
{
if (T[i] == 0)
nb_null++;
}
printf("\n nb_null=%d",nb_null);
}
Section B

Séance 1 – de 11:20 à 12:20 ----------------------------------------------------------------------------------

Exercise 1. Write a C program that displays the sum of 10 integers and their average.

Exercise 2. Run the following program:

#include<stdio.h>
void main() {
int T[5]={14,5,52,0,4},i;
for(i=0;i<5;i++)
{
if(T[i]%2==0)
T[i]=T[i]/2;
}
for(i=0;i<5;i++)
printf("\n %d",T[i]);
}

Séance 2 – de 12:20 à 13:20 -----------------------------------------------------------------------------------

Exercise 1. Write a C program that displays the sum of given integers and stops when -1 is
entered.

Exercise 2. Run the following program:

#include<stdio.h>
void main() {
int T[5]={14,5,51,0,3},i, nb_odd;
for(i=0;i<5;i++)
{
if(T[i]%2!=0)
nb_odd++;
}
printf("\n %d", nb_odd);
}
Section C

Séance 1 – de 8:30 à 9:30 --------------------------------------------------------------------------------------

Exercise 1. Write a C program that allows you to display from a list of real numbers entered by
the user all elements different of zero.

Exercise 2. Run the following program, with x=5:

#include<stdio.h>
void main() {
int T[5]={14,5,51,5,5},i,x, nb_x;
printf("enter a value");
scanf("%d",&x);
for(i=0;i<5;i++)
{
if(T[i]==x)
nb_x++;
}
printf("\n %d apears %d times",x, nb_x);
}
Séance 2 – de 9:30 à 10:30 --------------------------------------------------------------------------------------

Exercise 1. Write a C program that displays all integers between 1 and 100 that are multiples
of 3.

Exercise 2. Run the following program:

#include<stdio.h>
void main() {
int T[5]={4,1,5,-2,3},i,min;
min= 14;
for (i=1; i < 5; i++)

if (T[i] < min)


min = T[i];

printf("\n Min= %d", min);


}

You might also like