- Code:
#include <stdio.h>
#include <math.h>
#define NFOIS 5
main()
{ int i ;
float x ;
float racx ;
printf ("Bonjour\n") ;
printf ("Je vais vous calculer %d racines carrées\n", NFOIS) ;
for (i=0 ; i<NFOIS ; i++)
{ printf ("Donnez un nombre : ") ;
scanf ("%f", &x) ;
if (x < 0.0)
printf ("Le nombre %f ne possède pas de racine carrée\n", x)
else
{ racx = sqrt (x) ;
printf ("Le nombre %f a pour racine carrée : %f\n", x, racx) ;
}
}
printf ("Travail terminé - Au revoir") ;
}
function()
{
} //Here being the main functions without arguments
int i ;
in C pre 99, All variables must be declared before any other function is called
while this seems like it would not contraign us in modern compilators.
printf(string,)
Function that displays information on screen in a console
uses format handling to display variables
- Code:
printf("calculer %d racines", VARNAME);