热门

最新

红包

立Flag

投票

同城

我的

发布
dyf2019
dyf2019
5 年前
truedyf2019

// 奇偶归一.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
int main(int argc, char* argv[])
{
int n,temp=1;
printf("请输入任意正整数");
scanf("%d",&n);
while(n!=1)
{
if(temp<n)
{
temp=n;
}
if(n%2==1)
n=n*3+1;
else
n=n/2;
printf("%d\n",n);
}
printf("最大数字为%d\n",temp);
return 0;

CSDN App 扫码分享
分享
评论
点赞
打赏
  • 复制链接
  • 举报
下一条:
哈哈,又来拉单杠了,我感觉我一个正规的都做不了
立即登录