Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<ctype.h>
  4.  
  5. int main() {
  6.     char symbols[100] = {0};
  7.     char result[100] = {0};
  8.     int lenght;
  9.  
  10.     gets(symbols);
  11.  
  12.     lenght = (int) strlen(symbols);
  13.  
  14.     int lenght2 = lenght + lenght/3;
  15.  
  16.     result[lenght2 --]=0;
  17.  
  18.     int counter=1;
  19.  
  20.     for(int i=lenght-1; i>=0; i--)
  21.     {
  22.         result[lenght2--]=symbols[i];
  23.         if(counter % 3 == 0)
  24.  
  25.             result[lenght2--]=' ';
  26.             counter++;
  27.  
  28.     }
  29.     printf("%s", result);
  30.  
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement