9511_workbook

solved exercises from algorithms & programming I (9511) prof. Cardozo
Index Commits Files Refs README
guia03/ex21.c (273B)
   1 #include <stdio.h>
   2 #include <stdlib.h>
   3 
   4 #define MAX_LEN 100
   5 
   6 int main ( void ) {
   7 
   8     char buffer[MAX_LEN];
   9     float num;
  10     char num2[MAX_LEN];
  11 
  12     if(!fgets(buffer, MAX_LEN, stdin)) return 1;
  13 
  14     num = atof(buffer);
  15     sprintf(num2, "%.2f\n", num);
  16 
  17     printf("%s", num2);
  18     return 0;
  19 }