-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathZOHO question 1 -- on campus 2020[round-2].c
37 lines (36 loc) · 1.21 KB
/
ZOHO question 1 -- on campus 2020[round-2].c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* ZOHO question 1 -- on campus 2020.
* input : program
* output :
* g
* gr
* gra
* gram
* gramp
* grampr
* grampro
*/
#include <stdio.h>
#include <string.h>
int main()
{
int l;
char str[50];
scanf("%s",str);
l = strlen(str);
int g = l/2;
for(int i=1;i<=l;i++,printf("\n"))
{
g = l/2;
for(int j=1;j<=l-i;j++)
printf(" ");
for(int j=1;j<=i;j++)
{
printf("%c",str[g]);
g++;
if(str[g]=='\0')
g=0;
}
}
return 0;
}