c语言! 谁来帮忙!

来源:百度知道 编辑:UC知道 时间:2024/05/16 17:34:38
下列程序的功能为:倒序打印26个英文字母。请纠正程序中存在错误,使程序实现其功能
#include <stdio.h>
main()
{
char x;
x='z';
while(x!='a')
{
printf("%3d",x);
x++;
}
}

#include <stdio.h>
main()
{
char x;
x='z';
while(x>='a')
{
printf("%3c",x); //打印字母用%c
x--;
}
}

#include <stdio.h>
main()
{
char x;
x='z';
while(x>='a')
{
printf("%3c",x);
x-- ;
}
}

1.将%3d改为%3c,%d:输出十进制数的,%c输出单个字符的
2.将x++改为x--;
3.将小写z改为大写Z,将小写a改为大写A就打印大写字母的倒序了。

%3d改为%3c
x++改为x--

x--