求1到X的和

求1到X的和

public int SumFrom1ToX(int x)
{
    return(1+x)*x/2;
}

 

posted @ 2023-03-24 15:44  高小浩upup  阅读(29)  评论(0)    收藏  举报