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 revision
Previous revision
programming:c:hello_world [2014/12/11 16:04] czuberprogramming:c:hello_world [2014/12/11 16:22] (current) czuber
Line 1: Line 1:
 ====== Hello world ! ====== ====== Hello world ! ======
-===== Exercice 1 =====+===== Exercice 1 : printf =====
  
   * Open a terminal   * Open a terminal
Line 64: Line 64:
   * Run it again   * Run it again
   * Hello world !   * Hello world !
-===== Exercice 3 =====+===== Exercice 3 : scanf =====
  
   * Open a terminal   * Open a terminal
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 =====+===== Exercice 4 : for =====
  
   * Open a terminal   * Open a terminal
Line 127: Line 127:
 </code> </code>
   * Then run your programm by typing "./ex4" in the terminal   * Then run your programm by typing "./ex4" in the terminal
 +===== Exercice 5 : for in for =====
 +
 +  * Open a terminal
 +  * Create your file by writing the following command
 +<code c>
 +vim ex5.c
 +</code>
 +  * Enter insertion mode by pressing Insert
 +  * Write the lines below
 +<code c>
 +#include<stdio.h>
 +
 +int main(int argc, char** argv)
 +{
 +    int i = 1;
 +    int j = 1;
 +    int nbrMax = 10;
 +    for(i=1;i<=nbrMax;i++)
 +    {
 +        for(j=1;j<=nbrMax;j++)
 +        {
 +            printf("%d\t", i*j);
 +        }
 +        printf("\n");
 +    }
 +
 +    return 0;
 +}
 +</code>
 +  * Then press Esc key
 +  * Write :wq
 +  * Compile your code with the following line
 +<code>
 +gcc -Wall ex5.c -o ex5
 +</code>
 +  * Then run your programm by typing "./ex5" in the terminal
programming/c/hello_world.1418313872.txt.gz · Last modified: 2014/12/11 16:04 by czuber