Subtracting Two Numbers10 Mar 2025 | 1 min read There are three methods to subtract two numbers:
Subtraction in Simple CodeSubtraction of two numbers 30 and 15 is shown. Example: ExampleExecute NowOutput: ![]() Subtraction in FormBy inserting values in the form two numbers can be subtracted. Example: ExampleExecute NowOutput: ![]() Subtraction in Form without (-) OperatorBy inserting values in the form two numbers can be subtracted but without using (-) operator. Example: ExampleExecute NowOutput: ![]() Next TopicArea of Triangle |
Tutorial Compiler Programs OOPs Functions Interview Questions | PHP Programming Examples PHP programs are frequently asked in the interview. These programs can be asked from basics, control statements, array, string, oops,...
2 min read
Prime Number A number which is only divisible by 1 and itself is called prime number. Numbers 2, 3, 5, 7, 11, 13, 17, etc. are prime numbers. 2 is the only even prime number. It is a natural number greater than 1 and so 0 and 1...
1 min read
Adding Two Numbers There are three methods to add two numbers: Adding in simple code in PHP Adding in form in PHP Adding without using arithmetic operator (+). Adding in Simple Code Addition of two numbers 15 and 30 is shown here. Example: Example <?php $x=15; $y=30; $z=$x+$y; echo "Sum: ",$z; ?> Execute Now Output: Adding in Form Two numbers can be added...
1 min read
Area of a Rectangle Area of a rectangle is calculated by the mathematical formula, Length ∗ Breadth = Area Logic: Take two variables. Multiply both of them. Area of Rectangle in PHP Program to calculate area of rectangle with length as 14 and width as 12 is shown. Example: Example <?php $length = 14; $width...
1 min read
Factorial Program The factorial of a number n is defined by the product of all the digits from 1 to n (including 1 and n). For example, 4! = 4*3*2*1 = 24 6! = 6*5*4*3*2*1 = 720 Note: It is denoted by n! and is calculated only for positive integers. Factorial of...
2 min read
Palindrome Number A palindrome number is a number which remains same when its digits are reversed. For example, number 24142 is a palindrome number. On reversing it we?ll get the same number. Logic: Take a number. Reverse the input number. Compare the two numbers. If equal, it means number is palindrome Palindrome Number...
1 min read
Even Odd Program Even numbers are those which are divisible by 2. Numbers like 2,4,6,8,10, etc are even. Odd numbers are those which are not divisible by 2. Numbers Like 1, 3, 5, 7, 9, 11, etc are odd. Logic: Take a number. Divide it by 2. If the remainder is...
1 min read
Alphabet Triangle Method There are three methods to print the alphabets in a triangle or in a pyramid form. range() with for loop chr() with for loop range() with foreach loop Logic: Two for loops are used. First for loop set conditions to print 1 to 5 rows. Second for loop set conditions...
1 min read
Leap Year Program A leap year is the one which has 366 days in a year. A leap year comes after every four years. Hence a leap year is always a multiple of four. For example, 2016, 2020, 2024, etc are leap years. Leap Year Program This program states...
2 min read
Number Triangle Number triangle in PHP can be printed using for and foreach loop. There are a lot of patterns in number triangle. Some of them are show here. Pattern1 Example <?php $k=1; for($i=0;$i<4;$i++){ for($j=0;$j<=$i;$j++){ echo $k." "; $k++; } echo "<br>"; } ?> Execute Now Output: Pattern 2 Example <?php $k=1; for($i=0;$i<5;$i++){ for($j=0;$j<=$i;$j++){ if($j%2==0) { $k=0; } else { $k=1; } echo $k." "; } echo "<br>"; } ?> Execute Now Output: Pattern 3 Example <?php for($i=0;$i<=5;$i++){ for($j=1;$j<=$i;$j++){ echo $j; } echo "<br>"; } ?> Execute Now Output: Pattern 4 Example <?php for($i=0;$i>=5;$i++){ for($j=1;$j>=$i;$j++){ echo $i; } echo "<br>"; } ?< Execute...
1 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India