📜  一个数的科学写作功能——C程序设计语言代码示例

📅  最后修改于: 2022-03-11 15:04:42.335000             🧑  作者: Mango

代码示例1
#include 
void science_writing(float *number){
    int result=0;
    if(*number>1){
        while (*number>1){
            result++;
         *number/=10;
    }
    printf("%d",result);
    printf("the science writing of this number i;$s :%f × 10^%d",*number,result);
    }
    else if(*number<1){

        while(*number<1){
            result++;
            *number*=10;
        }
            printf("the science writing of this number i;$s :%f × 10^-%d",*number*0.1,result-1);
    }
}
int main()
{
    float momne;
    int result=0;
    printf("enter the number :");
    scanf("%f",&momne);
    science_writing(&momne);
  return 0;
}