202006XX-已知m和n都是整数,且都大于等于1,小于等于100,如果m+n=100,求mn最大值

#include <iostream>

using namespace std;

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int jzj=0;
int jzj1=0;
int m1=0,n1=0;
int main() {
for(int m=1;m<=100;m++){

for(int n=1;n<=100;n++)
{

jzj=m*n;

if (jzj1<jzj && m+n==100 )
{

jzj1=jzj;
m1=m;
n1=n;
}
}
}
cout<<jzj1<<endl;
cout<<"m1="<<m1<<endl;
cout<<"n1="<<n1;

return 0;
}

 

 

 

posted @ 2020-06-04 07:34  财盛  阅读(285)  评论(0编辑  收藏  举报