⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 分解质因数新解.txt

📁 爱因斯坦的思考题 二叉树算法集 分解质因数新解 石子归并问题等有趣的C程序
💻 TXT
字号:
 


源程序如下:

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int data, dataBuf;
    int s = 1;
    int i = 2;
    char c;

    printf("Please input an integer:");
    scanf("%d", &data);
    if  (data < 3)
    {
        return 0;
    }
    dataBuf = data;
    printf("%d = ", data);
    while (s < dataBuf)
    {
          if  ((data % i) == 0)
          {
              data /= i;
              s *= i;
              if  (s == dataBuf)
              {
                  printf("%d", i);/* if it is the last one */
              }
              else
              {
                  printf("%d*", i);/* if it is not the last one with a * follow it */
              }
          }
          else
          {
              i++;
          }
    }
    printf("\n");
    c = getchar();

 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -