Provide a positive integer (end with 0): 37 37 is not a bad speech. Provide a po
ID: 3630355 • Letter: P
Question
Provide a positive integer (end with 0): 37
37 is not a bad speech.
Provide a positive integer (end with 0): 54
54 is an ugly number.
54 = (2 ** 1) * (3 ** 3) * (5 ** 0)
Provide a positive integer (end with 0): 16,400
16,400 is not a bad speech.
Provide a positive integer (end with 0): 16200
16200 is an ugly number.
16,200 = (2 ** 3) * (3 ** 4) * (5 ** 2)
Provide a positive integer (end with 0): 0
Explanation / Answer
#include bool IsUgly(int n);int main(){ int n=0; if(IsUgly(n)){printf(“The given number is ugly”); else printf(“The given is bad speech”); } }bool IsUgly(int n){Printf(“PROVIDE A POSITIVE INTEGER press 0 to end”);Scanf(“%d”,&n)If(n>0){ while(!(n%2)) n=n/2; while(!(n%3)) n=n/3; while(!(n%5)) n=n/5; return n;}If(n==0) Return false;}Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.