只有80

P5705 【深基2.例7】数字反转

chiXL2013 @ 2024-12-01 12:57:42

include<stdio.h>

int main() { float num; int zheng; float xiao; scanf("%f",&num); zheng=(int)num; xiao=num-zheng; int rev=0; while(zheng!=0) { int temp=zheng%10; zheng=zheng/10; rev=rev*10+temp; } double c=(double)rev/1000;

int d=(int)(xiao*10); printf("%.3lf",c+d); return 0;

}

#include<stdio.h>
int main()
{
    float num;
    int zheng;
    float xiao;
    scanf("%f",&num);
   zheng=(int)num;
    xiao=num-zheng;
   int rev=0;
   while(zheng!=0)
   {
       int temp=zheng%10;
       zheng=zheng/10;
       rev=rev*10+temp;
   }
   double c=(double)rev/1000;

   int d=(int)(xiao*10);
   printf("%.3lf",c+d);
   return 0;

}

by SunXiaolang @ 2024-12-01 15:57:23

#include<bits/stdc++.h>
using namespace std;

int main(){
    char a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    cout<<e<<d<<c<<b<<a;
}

@chiXL2013@chiXL2013@chiXL2013


by laoniubi @ 2024-12-10 22:15:57

@SunXiaolang 这道题偷鸡比较简单


by M_C_Yyyds @ 2024-12-16 21:13:29

@SunXiaolang你不够严谨,定义一个字符串,然后倒叙输出就好了


|