用c 语言6.随机生成一个五位数,将其反序打印出。例如12345 打印出54321?

如题所述

#include <stdio.h>

#include <stdlib.h>

#include <time.h>

int main()

{ int a,b=0;

  srand(time(0));

  a=rand()%90000+10000;

  printf("%d\n",a);

  for(; a; a/=10)

    b=b*10+a%10;

  printf("%d\n",b);

  return 0;

}

温馨提示:答案为网友推荐,仅供参考
相似回答