void printTable() {
}
printf("\n");
printf(" ");
for (c = 0; c <= 10; ++c) {
printf(" -");
}
printf("\n");
// calculations
int r;
for (r = 0; r <= 10; ++r) {
// row headers
printf("%2d|", r);
// calculation for the current row
for (c = 0; c <= 10; ++c) {
printf("%4d", (r * c));
}
printf("\n");
}
}
#include<stdio.h>
#include<conio.h>
void main()
{
int n,p,i;
printf("\n enter the noof which u want to see the table");
scanf("%d",&n);
for(i=1;i<=10;i++)
{
p=n*i;
printf("\n%d *%d=%d",n,i,p);
}
getch();
}
#include
#include
main()
{
int s,k,mul;
clrscr();
for(s=0;s<=12;s++)
{
for(k=0;k<=10;k++)
mul=s*k;
}
printf("the table for 1 to 12 no. is%d",mul);
getch();
return 0;
}
#include<iostream>
#include<iomanip>
int main()
{
using namespace std;
int r,c;
cout<<"Multiplication Table\n\n"<<setw(4)<<"";
for(c=1; c<=12; ++c )
cout<<setw(4)<<c;
cout<<endl;
for(r=1; r<=12; ++r )
{
cout<<setw(4)<<r;
for(c=1; c<=12; ++c )
cout<<setw(4)<<r*c;
cout<<endl;
}
cout<<endl;
return(0);
}
#include<iostream>
#include<iomanip>
using std::cout; // std out
using std::endl; // newline and flush
using std::setw; // set width
int main()
{
// the largest value is 144 (12*12) which has 3 digits
// thus each value requires a minimum width of 4 columns
unsigned width=4;
// loop control variables
unsigned row, column;
// display the table title
cout<<"Multiplication Table\n"<<endl;
// display the column header
cout<<setw(width)<<'|';
for (column=1; column<=12; ++column)
cout<<setw(width)<<column;
cout<<endl;
// underline the column header
for (column=0; column<=12; ++column)
cout<<setw(width)<<"----";
cout<<endl;
// loop through each row
for (row=1; row<=12; ++row)
{
// display the row header
cout<<setw(width-1)<<row<<'|';
// loop through each column and
// display the row and column products
for (column=1; column<=12; ++column)
cout<<setw(width)<<row*column;
cout<<endl;
}
cout<<endl;
}
Output:
Multiplication Table
| 1 2 3 4 5 6 7 8 9 10 11 12
----------------------------------------------------
1| 1 2 3 4 5 6 7 8 9 10 11 12
2| 2 4 6 8 10 12 14 16 18 20 22 24
3| 3 6 9 12 15 18 21 24 27 30 33 36
4| 4 8 12 16 20 24 28 32 36 40 44 48
5| 5 10 15 20 25 30 35 40 45 50 55 60
6| 6 12 18 24 30 36 42 48 54 60 66 72
7| 7 14 21 28 35 42 49 56 63 70 77 84
8| 8 16 24 32 40 48 56 64 72 80 88 96
9| 9 18 27 36 45 54 63 72 81 90 99 108
10| 10 20 30 40 50 60 70 80 90 100 110 120
11| 11 22 33 44 55 66 77 88 99 110 121 132
12| 12 24 36 48 60 72 84 96 108 120 132 144
#include<stdio.h>int main (void) {
int row, column;
for (column=1; column<=12; ++column) {
printf ("\t%d", column);
}
printf ("\n");
for (row=1; row<=12; ++row ) {
printf ("%d", row);
for (column=1; column<=12; ++column) {
printf ("%d\t", row*column);
}
printf ("\n");
}
return 0;
}
There are many ways to solve this problem. You can use different algorithms to fix this. But you may want to try this algorithm. It works for me.
Here is a sample code:
#include
#include
int main (int argc, char *argv[])
{
int numbers = 0;
int total = 0;
int counter = 0, counter2 = 0;
printf ("Type the numbers that will be printed in multiplication table: ");
scanf ("%d", &numbers); // ask user how many numbers to include
printf ("\nMultiplication Table: 1 to %d\n\n", numbers);
for (counter = 1; counter <= numbers; counter++) { // type the number of columns
printf ("\t%d", counter);
}
printf ("\n");
for (counter = 1; counter <= numbers; counter++) {
printf ("\n%d", counter);
for (counter2 = 1; counter2 <= numbers; counter2++) {
total = counter * counter2; // multiply the multiplier times the multiplicand
printf ("\t%d", total); // print the total
}
}
return (0);
} // main
write a c program that prints out the multiplication table of 4 using function
for (unsigned i=1; i!=100; ++i)
std::cout << "2 x " << i << " = " << i*2 << std::endl;
std::cout << "Enter a whole number: ";std::cin >> num;
for (unsigned x=1; x<=12; ++x) std::cout << x*num << ',';
std::cout<<std::endl;
Use a counted for loop. On each iteration, multiply the control variable by 2 and print the result.
Option explicit Dim val,indx val=inputbox("enter any number") For indx= 1 to 10 print val&"*"&indx&"="&val&"*"indx Next
// example of 1..12x12 table for($i = 1; $i <= 12; $i++) { for($j = 1; $j <= 12; $j++) { print ($i * $j) ." "; } print "\n"; }
#include <stdio.h> #include<conio> void main () {int a,i:, printf("\n The Multiplication table of 5 is n"):, For(i=1;i=20;i++) Printf("%d",a*i); getch(); }
#include#includevoid main(){ int a,i;printf("\nThe Multiplication table of 5 is:\n");for(i=1;i
Use a counted for loop. On each iteration, multiply the control variable by 2 and print the result.
Option explicit Dim val,indx val=inputbox("enter any number") For indx= 1 to 10 print val&"*"&indx&"="&val&"*"indx Next
// example of 1..12x12 table for($i = 1; $i <= 12; $i++) { for($j = 1; $j <= 12; $j++) { print ($i * $j) ." "; } print "\n"; }
#include <stdio.h> #include<conio> void main () {int a,i:, printf("\n The Multiplication table of 5 is n"):, For(i=1;i=20;i++) Printf("%d",a*i); getch(); }
#include#includevoid main(){ int a,i;printf("\nThe Multiplication table of 5 is:\n");for(i=1;i
int firstNumber,secondNumber for(firstNumber = min; firstNumber <= max; firstNumber++); { for(secondNumber = min; secondNumber <=max; secondNumber++); int result firstNumber * secondNumber; }
a = 0while a < 10 :a += 1print (a)Write the above simple script in a text editor (I use nano). Save as loop.py in home folder. To run, open a terminal and at the prompt, write: python loop.pyResult:rodney@downstairs:~$ python loop.py12345678910
$vi multable.sh echo "enter the value of n:" read n i=1 for((i=1;i<=10;i++)) do echo " $n * $i = `expr $n \* $i`" done
http://www.mathsisfun.com/multiplication-table-bw.html this is a printable multiplication table. Multiplication doesn't change no matter what grade so just leave the chart as is.
#include<stdio.h> main() { int i,n; clrscr(); printf("enter the value"); scanf("%d", &n); while(i<=10) { printf("\n %d*%d=%d",n,i,(i*n)); i++; } getch(); }
class table{public static void main(String args[])int n=2;System.out.println("Table of " + n + " is :");int result;for (int a = 1; a
sum=0 i=1 echo "Enter any number " read num while [ $i -le 10 ] do sum=`expr $num \* $i` i=`expr $i + 1` echo "Table of a number is " $sum done