9511_workbook

solved exercises from algorithms & programming I (9511) prof. Cardozo
Index Commits Files Refs README
guia03/ex15.c (330B)
   1 #include <stdio.h>
   2 
   3 #define MAX_LEN 100
   4 
   5 int main(void) {
   6 
   7     int i, j;
   8     char str[MAX_LEN];
   9 
  10     fgets(str, MAX_LEN, stdin);
  11 
  12     /* Count consecutive starting blank spaces */
  13     for(i = 0; str[i] == 32; i++)
  14         ;
  15 
  16     /* Shift the string i times to the left */
  17     for(j = 0; str[j]; j++)
  18         str[j] = str[j + i];
  19 
  20     printf("%s", str);
  21     return 0;
  22 }