jc java_JC.java

package com.example.demo.jiecheng.controller;

import com.example.demo.th32.model.th32;

import org.slf4j.Logger;

import org.slf4j.LoggerFactory;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

@RestController

public class JC {

Logger log = LoggerFactory.getLogger(JC.class);

@Autowired

@RequestMapping("/jc")

public static String jc(String[] args) {

int sum = 1;

int i = 1;

int w = 0;

while (sum <= sum * i) {

sum = sum * i;

w = i;

i++;

}

long a = 1;

long w1 = 0;

long b = 1;

while (a <= a * b) {

a = a * b;

w1 = b;

b++;

}

short c = 1;

short w2 = 0;

short d = 1;

while (c <= (short) (c * d)) {

c = (short) (c * d);

w2 = d;

d++;

}

byte e = 1;

byte f = 1;

byte w3 = 0;

while (e <= (byte) (e * f)) {

e = (byte) (e * f);

w3 = f;

f++;

}

int n4 = 1;

int sum4 = 1;

int w4 = 0;

for (char i4 = 1; i4 < n4 + 1; i4++) {

sum4 = sum4 * i4;

if (sum4 > 0 && sum4 <= Character.MAX_VALUE) {

w4 = i4;

n4++;

}

}

double n5 = 1.0;

double sum5 = 1.0;

double w5 = 0;

double s = 0;

for (double i5 = 1; i5 < n5 + 1; i5++) {

sum5 = sum5 * i5;

if (sum5 > 0 && sum5 <= Double.MAX_VALUE) {

s = sum5;

w5 = i5;

n5++;

}

}

float n6 = 1.0f;

float sum6 = 1.0f;

float w6 = 0;

float s1 = 0f;

for (float i6 = 1; i6 < n6 + 1; i6++) {

sum6 = sum6 * i6;

if (sum6 > 0 && sum6 <= Float.MAX_VALUE) {

s1 = sum6;

w6 = i6;

n6++;

}

}

return ("int阶乘最大"+w+"的阶乘"+sum) +";"+

("long阶乘最大"+w1+"的阶乘"+a)+";"+

("short阶乘最大"+d+"的阶乘"+c)+";"+

("byte阶乘最大"+f+"的阶乘"+e)+";"+

("char阶乘为"+w4+"最大值"+sum4)+";"+

("double阶乘为"+w5+"最大值"+s)+";"+

("float阶乘为"+w6+"最大值"+s1);

}

}

一键复制

编辑

Web IDE

原始数据

按行查看

历史

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值