PTA诚信第一C语言

7-5 诚信第一分数 5
全屏浏览题目
切换布局
作者 张洪旗
单位 海南师范大学
诚信是为人之本。竖着依次输出该字符串“Honesty test, no cheating!”
输入格式:
Honesty test, no cheating!
输出格式:
看样例
输入样例:
在这里给出一组输入。例如:
Honesty test, no cheating!
输出样例:
在这里给出相应的输出。例如:
H
o
n
e
s
t
y

t
e
s
t
,

n
o

c
h
e
a
t
i
n
h
!
怎样才能够竖着输出??(求各位帮忙)


for(i=0;a[i]!='\0';i++)
    printf("%c\n",a[i]);

供参考:

#include <stdio.h>
int main()
{
    char str[128];
    int  i=0;
    gets(str);
    while(str[i]){
        if (str[i] != ' ')
            printf("%c\n", str[i]); 
        i++;
    }
    return 0;
}