Program to print multiplication table of 5 using While loop

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

  1. Use a While loop to iterate from 1 to 10.
  2. Multiply the current loop number (i) by 5.
  3. Print the result in the format 5 x i = result.

Program to print multiplication table of 5 using While loop

#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++;
        }
    }
}

List of All Programs