User Tools

Site Tools


programming:c:hello_world

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
programming:c:hello_world [2014/12/11 16:01] czuberprogramming:c:hello_world [2014/12/11 16:04] czuber
Line 93: Line 93:
 </code> </code>
   * Then run your programm by typing "./ex3" in the terminal   * Then run your programm by typing "./ex3" in the terminal
 +===== Exercice 4 =====
 +
 +  * Open a terminal
 +  * Create your file by writing the following command
 +<code c>
 +vim ex4.c
 +</code>
 +  * Enter insertion mode by pressing Insert
 +  * Write the lines below
 +<code c>
 +#include<stdio.h>
 +
 +int main(int argc, char** argv)
 +{
 +    int nbrMax;
 +    int i = 1;
 +    printf("Salut\nEntre un nombre\n");
 +    scanf("%d", &nbrMax);
 +    printf("Affichage de nombres de 1 à %d\n", nbrMax);
 +    for(i=1;i<=nbrMax;i++)
 +    {
 +        printf("%d\n", i);
 +    }
 +    
 +    return 0;
 +}
 +</code>
 +  * Then press Esc key
 +  * Write :wq
 +  * Compile your code with the following line
 +<code>
 +gcc -Wall ex4.c -o ex4
 +</code>
 +  * Then run your programm by typing "./ex4" in the terminal
programming/c/hello_world.txt · Last modified: 2014/12/11 16:22 by czuber