本人是C语言初学者,现有一问题请各位高手解决一下,谢谢了!

2024-11-28 12:18:49
推荐回答(3个)
回答1:

第一个:
#include
int main()
{
int x,j,cnt,i,a[5];
scanf("%d",&x);
i=0;
cnt=1;
while(x>=10)
{
a[i++]=x%10;
x/=10;
cnt++;
}
a[i]=x;
for(j=i;j>=0;j--)
printf("%d ",a[j]);
printf("\n%d",cnt);
return 0;
}
第二个:
#include
int main()
{
double F,C;
scanf("%lf",&F);
C=5.0/9.0*(F-32.0);
printf("%lf",C);
return 0;
}

回答2:

#include
int main()
{
int n, a[5], l;
scanf( "%d", &n );
l = 0;
while ( n!=0 )
{
a[l] = n%10;
n /= 10;
l++;
}
printf( "n是%d位数\n", l-- );
while ( l>=0 )
printf( "%d\n", a[l--] );
return 0;
}

#include
int main()
{
float c, f;
scanf( "%f", &f );
c = 5*(f-32)/9;
printf( "%g\n", c );
scanf( "%f", &f );
return 0;
}

回答3:

#include
void main()
{
float c,f;
printf("Input f:");
scanf("%f",&f);
c=5/9*(f-32);
printf("\nc=%-5.2f\n",c);
getch();
}

#include
void main()
{
long n,i;
printf("Input:");
scanf("%l",n);
i=n/10000;
if(i>0)printf("\n5");
else if(n/1000)printf("\n4");
else if(n/100)printf("\n3");
else if(n/10)printf("\n2");
else printf("\n1");
getch();
}