Computer Science, asked by Saliq8179, 1 year ago

Write an Algorithm for multiplication table of an integer?

Answers

Answered by Anonymous
0
What is an algorithm for printing a table of 2?

Still have a question? Ask your own!
What is your question?

Ad by Elastic.co

The search platform you've been looking for.

Build a fast, relevant search experience for your app or website in minutes.

Free Trial

5 ANSWERS



Ravi Goswami, B.C.A. Computer Programming & Computer Science, Lokmanya College of Computer Application (2019)

Answered Sep 3, 2018 · Author has 65 answers and 31.2k answer views

Programs to print table of a number.
Given a number n as input, we need to print its table.
For CPP :-

// CPP program to print table of a number

#include <iostream>

using namespace std;

int main()

{

int n = 5; // Change here to change output

for (int i = 1; i <= 10; ++i)

cout << n << " * " << i << " = "

<< n * i << endl;

return 0;

}

For JAVA:-

// Java program to print table

// of a number

import java.io.*;

class table

{

// Driver code

public static void main(String arg[])

{

// Change here to change output

int n = 5;

for (int i = 1; i <= 10; ++i)

System.out.println(n + " * " + i +

" = " + n * i);

}

}

For PYTHON:-

# Python Program to print table

# of a number upto 10

def table(n):

for i in range (1, 11):

# multiples from 1 to 10

print "%d * %d = %d" % (n, i, n * i)

# number for which table is evaluated

n = 5

table(n)

For C# :-

// C# program to print

// table of a number

using System;

class GFG

{

// Driver code

public static void Main()

{

// Change here to

// change output

int n = 5;

for (int i = 1; i <= 10; ++i)

Console.Write(n + " * " + i +

" = " + n *

i + "\n");

}

}

For PHP :-

<?php

// PHP program to print

// table of a number

// Driver Code

$n = 5; // Change here to

// change output

for ($i = 1; $i <= 10; ++$i)

echo $n , " * " , $i ,

" = " , $n *

$i , "\n";

Hope it helps….!!!
this is for table of 2.

Similar questions