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.
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.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
My apologies SalemCode:#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