+ 3
What is the function(in C) to find the minimum value from a loop?
9 Answers
+ 1
#include<stdio.h>
int main(){
int n, x, y,i,s,a;
scanf("%d", &n);
for(i=n; i>=1; i--){
if(n%i==0){
x=n/i;
y=2*(x+i);
}}
printf("%d\n",y);
return 0;
}
This is my code. From here I want the minimum value of y.
+ 1
Your code is able to find out only in one case(3 numbers). I wanted a code for any amount of numbers.
+ 1
đđ
+ 1
It's ok. Thanks.
0
Hi