PHP Program to find Composite Number
What is Composite Number?
A positive integer that has at least one divisor other than 1 and itself.
Tips: It is recommended to use our online Composite Numbers calculator for better understanding.
Examples
The following table provides few examples of composite numbers.
Number | Divisor | Result |
---|---|---|
13 | 1, 13 | Not a Composite Number |
15 | 1, 3, 5, 15 | Composite Number |
47 | 1, 47 | Not a Composite Number |
Using for loop
In the following example, we will check whether the number 12 is a Composite number or not using for loop.
Example
Output
Using while loop
In the following example, we will check whether the number 12 is a Composite number or not using while loop.
Example
Output
Using do while loop
In the following example, we will check whether the number 12 is a Composite number or not using do while loop.
Example
Output
Composite Numbers between the Given Range
In the following example, we will find all the Composite numbers between 1 and 10.
Example
Output
Check Whether the Number is Prime or Composite
In the following example, we will check whether the number 12 is a Prime number or Composite number.
Example
Output
Reminder
Hi Developers, we almost covered 90% of String functions and Interview Question on PHP with examples for quick and easy learning.
We are working to cover every Single Concept in PHP.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.