+ 2
I am having problem with calculating the lcd of a series of number in an array
If someone can help me with an advise, that'll be wonderfull
3 Respuestas
0
Least common denominator
0
You guys are very helpful, thanx, by the way, can you help me solve where is the problem in my code?
#include <stdio.h>
#define M 100
int main(){
int num[M];
int i;
int mcm = 2;
int flag;
int res;
printf("Inseriamo dei valori\n");
for (i = 0; i < M; i++){
scanf("%d", &num[i]);
if (num[i] == 1)
break;
}
flag = i;
//printf("%d", flag);
for(i = 0; i < flag; i++){
res = mcm%num[i];
if (res == 0){
printf("il mcm e' %d\n", mcm);
// res = mcm%num[i];
}else{
mcm++;
i = 0;
continue;
}
}
printf("%d", mcm);
}
0
Hello Jay, how are you? I would like to ask you something, but i do not know how to write you a private message.