用C语言简单的编一点东西(很简单)高手速度来

来源:百度知道 编辑:UC知道 时间:2024/05/16 19:20:10
都是用C语言遍的简单的东西~~~希望个位大大帮忙
1 输入一个3位数,将其各位数字反序输出 的编法~~(例如输入123,输出321)

2 输入三角形的边长a,b,c,求三角形的面积 有提示:面积=sprt(s(s-a)(s-b)(s-c)),s=(a+b+c)/2

急求答案,简单复杂都可以,希望大家不吝赐教

小妹先行谢过了~
希望给出比较详细的过程和说明~~谢谢啦~

1题.#include<stdio.h>
void main()
{
int i,a[i],temp;
printf("plealse inpute three numbers:");
for(i=0;i<3;i++)
scanf("%",a[i]);
temp=a[0];
a[0]=a[2];
a[2]=temp;
printf("the invese numbers:");
for(i=0;i<3;i++)
printf("%d",a[i]);
}

第2题:
#include<stdio.h>
#include<math.h>
void main()
{
int i,x,y,z,s,sq;
printf("please inpute sides of triangle:");
scanf("%d%d%d",&x,&y,&z);
if(x+y<z!!x+z<y!!y+z<x)
printf("error,please input again:");
else
{
s=(x+y+z)/2;
sq=sqrt(s(s-a)(s-b)(s-c));
}
printf("area:%d",sq);
}
调试过了,没问题的

1)
main()
{
int a,indiv,ten,hundred;
scanf("%d",&a);
hundred=a/100;
ten=a/10-hundred*10;
indiv=a%10;
printf("%d%d%d\n",indiv,