Initiation Au Langage C
Initiation Au Langage C
Initiation Au Langage C
LANGAGE C
Initiation à la programmation
GENERALITES
La programmation est une branche de l’informatique qui sert à créer des programmes. Tout ce
que vous possédez sur votre ordinateur est un programme : votre navigateur Internet (Internet
Explorer, Firefox, Opera, etc.), votre système d’exploitation (Windows, GNU/Linux, Mac OS X, etc.) qui
est un regroupement de plusieurs programmes appelés logiciels, votre lecteur MP3, votre logiciel de
discussion instantanée, vos jeux vidéos, etc.
Le langage C
Il a été créé en 1972. Le langage C est une évolution du langage B.
Le langage C est encore très utilisé aujourd'hui (dans le top 10 des langages de programmation les
plus utilisés).
Exemple :
#include<stdio.h>
Cette bibliothèque contient les fonctions printf et scanf
Initiation à la programmation
TABLEAU DE CONVERSION
Algorithme Langage C
Déclaration de variables
Nom_Variables : Types_Variable Type_Variables : Nom_Variables ;
Ex : Ex :
Nombre2 : Entier int : Nombre2;
Instructions
Afficher printf
Ex : Ex :
Afficher(“Entrer un nombre”) printf(“Entrer un nombre”);
Saisir scanf
Saisir(Nombre2) scanf(“Code_Type_Variable”,&Nom_
variable);
scanf(“%d”,&Nombre2);
Initiation à la programmation
TABLEAU DE CONVERSION
Algorithme Langage C
Types de variables Codes du type
Entier int %d
Réel float %f
Caractère char %c
Chaîne de caractère char %s
Initiation à la programmation
EXEMPLE D’UN PROGRAMME : SOMME DE DEUX NOMBRES
Initiation à la programmation
TABLEAU DE CONVERSION
Algorithme Langage C
Structure Conditionnelle SI
Si <condition> if(Conditions) Exemple :
alors { if(Nombre == 0)
Instructions Instructions; {
[sinon } printf(“Impossible de faire la
instructions] else division”);
Fsi { }
Instructions; else
Exemple : } {
division = nombre1 +
nombre2 ;
}
Initiation à la programmation
TABLEAU DE CONVERSION
Algorithme Langage C
Structure Répétitive Pour
Pour variable for(Initialisation, Exemple :
valeur_initiale à Conditions, for(i =0;i<=10;i++)
valeur_finale Faire Incrementation) {
Instructions { printf(“%d”,i);
FPour Instructions; }
}
Initiation à la programmation
TABLEAU DE CONVERSION
Algorithme Langage C
Structure Répétitive Tant que…Faire
Tant que <condition while(Conditions) Exemple :
(vraie)> faire { i = 0;
Instructions Instructions; while(i<=10)
FTQ } {
printf(“%d”,i);
i++;
}
Initiation à la programmation
TABLEAU DE CONVERSION
Algorithme Langage C
Structure Répétitive Répéter…Jusqu’à
Répéter do Exemple :
Instructions { i = 0;
Jusqu’à <condition> Instructions; do
} {
while(Conditions); printf(“%d”,i);
i++;
}
while(i<=10)
Initiation à la programmation
TABLEAU DE CONVERSION
Algorithme Langage C
Création d’un tableau à une dimension
Tab : Tableau[1..5] De Type_tableau : nom du Exemple : Déclaration d’un tableau de
entier tableau[taille] ; 3 valeurs de type Entier
Lors de la creation d’un tableau,
il faut une variable qui sera int tab[3]i;
initialisée à 0. L’indice d’un for(i=0, i<3,i++)
tableau commence toujours à
{
partir de 0.
La saisie des valeurs se fait avec printf(“Saisir le N°”,i+1);
la boucle for scanf(“%d”,&tab[i]);
}
Initiation à la programmation
CORRECTION SOMME + DIVISION DE DEUX NOMBRES ENTIERS
Initiation à la programmation
CORRECTION CALCUL DU CARRE D’UN NOMBRE
Initiation à la programmation
ALGORITHME SOMMES DE DEUX NOMBRES AVEC LE LANGAGE PYTHON
Algorithme PYTHON
Initiation à la programmation
ALGORITHME SOMMES DE DEUX NOMBRES AVEC LE W-LANGAGE
Algorithme W-LANGAGE
Initiation à la programmation
TOP 10 DES LANGAGES DE PROGRAMMATION EN 2020
1. Java
2. Langage C
3. Python
4. C++
5. C#
6. Visual Basic.Net
7. Javascript
8. PHP
9. SQL
10.Langage Go
Initiation à la programmation