We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 74afcfa + 3d2d15c commit f7593acCopy full SHA for f7593ac
ugly numbers
@@ -0,0 +1,38 @@
1
+# include <stdio.h>
2
+# include <string.h>
3
+
4
+int main()
5
+{
6
+int n,x=0;
7
+ printf("Input an integer number: ");
8
+ scanf("%d",&n);
9
10
+ if (n <= 0) {
11
+ printf("Input a correct number.");
12
+ }
13
+ while (n != 1)
14
+ {
15
+ if (n % 5 == 0)
16
17
+ n /= 5;
18
19
+ else if (n % 3 == 0)
20
21
+ n /= 3;
22
23
+ else if (n % 2 == 0)
24
25
+ n /= 2;
26
27
+ else
28
29
+ printf("It is not an ugly number.\n");
30
+ x = 1;
31
+ break;
32
33
34
+ if (x==0)
35
36
+ printf("It is an ugly number.\n");
37
38
+}
0 commit comments