C语言的学习5(数据的输出)

格式化输出

//实例3-5:格式化输出
#include "stdio.h"
#include
"stdlib.h"//因为后面要用到toupper(字符),所以要在程序的头部使用语句"stdlib.h"进行包含
#include "conio.h"
void main()
{
float PI=3.14159;
int n;
char ch;
{
printf(
"\t格式化输出\n");
printf(
"请输入一个小写字母:");
getch();
scanf(
"%c",&ch);
printf(
"%c转化为大写字母是:%c\n\n",ch,toupper(ch));//toupper(字符)是将字符转化为大写
}

{
printf(
"请输入圆的半径:");
scanf(
"%d",&n);
printf(
"半径为%d的圆周长为:%.2f\n\n",n,2*PI*n);
}


}


 

原文地址:https://www.cnblogs.com/KeenLeung/p/2159912.html