Let M (p,q,r,N) be the largest positive integer less than N or equal to N that has only p , q AND r as its distinct prime factors. ex 100(2,3,5)
output = 90 because 2*3^2*5.
Printable View
Let M (p,q,r,N) be the largest positive integer less than N or equal to N that has only p , q AND r as its distinct prime factors. ex 100(2,3,5)
output = 90 because 2*3^2*5.
So where is your initial code effort?
You can't just dump your question and hope we'll do all the work for you.
My apologies Salem :)Code:#include <stdio.h>int main()
{
int d = 100, num=1;
while(num < 10){
if(num*5 < d){
num*=5;
}
else if(num*3<d){
num*=3;
}
else if(num*2<d){
num*=2;
}
}
printf("%d", num);
return 0;
}
Code:#include <stdio.h>
#include <stdlib.h>
//John Raphael B. Pascua
int main(){
int a = 3,b = 7,c = 11,d = 1000000, e = a*b*c;
while(e < d){
if(e * c < d){
e *=c;
}else if (e * b < d){
e *=b;
}else if (e * a < d){
e *=a;
}
}
printf(" %d\n", e);
return 0;
}
nvm just did it right hahaha thanks for always replying to all my posts salem :)