9511_workbook

solved exercises from algorithms & programming I (9511) prof. Cardozo
Index Commits Files Refs README
guia01/ej5.c (323B)
   1 #include <stdio.h>
   2 #include <math.h>
   3 
   4 int main( void ) {
   5 
   6     float raiz = 25;
   7     float inv = 4;
   8 
   9     printf("sqrt(%.2f) = ", raiz);
  10 
  11     if(raiz > 0)
  12         raiz = sqrt(raiz);
  13     else
  14         return 1;
  15 
  16     printf("%.2f\n", raiz);
  17     printf("inv(%.2f) = ", inv);
  18 
  19     if (inv != 0)
  20         inv = 1/inv;
  21     else
  22         return 1;
  23 
  24     printf("%.2f\n", inv);
  25 
  26     return 0;
  27 }