Program to print multiplication table of 5 using While loop
- Write a program to print multiplication table of 5 using While loop in C
- Write a program to print multiplication table of 5 using While loop in C++
- Write a program to print multiplication table of 5 using While loop in Python
- Write a program to print multiplication table of 5 using While loop in PHP
- Write a program to print multiplication table of 5 using While loop in Java
- Write a program to print multiplication table of 5 using While loop in Java Script
- Write a program to print multiplication table of 5 using While loop in C#
Explanation:
Using a for loop, you run through numbers 1 through 10 (or any range) and multiply each one by 5 to produce the multiplication table of 5.
Logic
- Use a While loop to iterate from 1 to 10.
- Multiply the current loop number (i) by 5.
- Print the result in the format 5 x i = result.
Program to print multiplication table of 5 using While loop
-
C
-
C++
-
Python
-
PHP
-
JAVA
-
Java Script
-
C#
#include <stdio.h>
int main() {
int i = 1;
while (i <= 10) {
printf("5 * %d = %d\n", i, 5 * i);
i++;
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
int i = 1;
while (i <= 10) {
cout << "5 * " << i << " = " << 5 * i << endl;
i++;
}
return 0;
}
i = 1
while i <= 10:
print(f"5 * {i} = {5 * i}")
i += 1
<?php
$i = 1;
while ($i <= 10) {
echo "5 * $i = " . (5 * $i) . "\n";
$i++;
}
?>
public class MultiplicationTable {
public static void main(String[] args) {
int i = 1;
while (i <= 10) {
System.out.println("5 * " + i + " = " + (5 * i));
i++;
}
}
}
let i = 1;
while (i <= 10) {
console.log(`5 * ${i} = ${5 * i}`);
i++;
}
using System;
class Program {
static void Main() {
int i = 1;
while (i <= 10) {
Console.WriteLine($"5 * {i} = {5 * i}");
i++;
}
}
}