English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Im trying to write a prog. that recieve a number bigger than zero and then it shows the multiplication tables from numb. (1) to the numb. I entered......like this:
==========
please insert a numb. = 2 ( for example)

multip. table. of 1
1*1=1
1*2=2
1*3=3
.
.
1*12=12

multip. table of 2:
2*1=2
2*2=4
2*3=6
.
.
.
2*12=24
=====================
===================
plz help cause I can make the mulip. table but not in that way like a series...............

2006-11-22 21:17:25 · 4 answers · asked by Anonymous in Computers & Internet Programming & Design

4 answers

Here is a program which first computes all the values and then, print it in the actual table manner. If value is 34, table for 1 to 10 will be printed first, then from 11 to 20, 21 to 30 and then from 31 to 34.

#include
#include

void main()
{
clrscr();
int a[50][12];
int n;
printf("Enter the number till which you need tables ");
scanf("%d",&n);
for(int i= 1;i<=n;i++)
for(int j=1;j<=12;j++)
a[i][j] = i*j;

for(int k=1;k<=n/10;k++)
{

for(i = 1;i<=12;i++)
{
for(int j = (k-1)*10+1;j<=(k-1)*10+10;j++)
printf("%d\t",a[j][i]);
//printf("\n");
}
printf("\n");
getch();
}

for(i = 1;i<=12;i++)
{
for(int j = (n/10)*10+1;j<=n;j++)
printf("%d\t",a[j][i]);
printf("\n");
}
printf("\n");

}

2006-11-22 23:25:52 · answer #1 · answered by manoj Ransing 3 · 0 0

in oracle

DECLARE
nofotable NUMBER;
endno NUMBER;
BEGIN
nofotable := :a;
endno := :b;

FOR numb IN 1 .. nofotable
LOOP
FOR series IN 1 .. endno
LOOP
DBMS_OUTPUT.put_line (series || ' * ' || numb || ' = '
|| series * numb
);
END LOOP;

DBMS_OUTPUT.put_line (CHR (9));
END LOOP;
END;


explanation

we have to insert two values for a and b
a indicates how many tables we want
b indicates last no of the one table

example
if a=2 and b=10 means

1*1=1
upto
10*1=10

and
1*2=2
upto
10*2=20

2006-11-23 05:57:40 · answer #2 · answered by publicguest 2 · 0 0

Soln in C:

scanf("%d", &numb);
for(int i=1;i<=numb;i++)
{
for(int j=1;j<=10;j++)
{
printf("%d*%d=%d\n",i,j,(i*j));
}
printf("\n");
}

2006-11-23 06:03:08 · answer #3 · answered by Vaibhav 4 · 0 0

you didnt describe that in which language you are programming.
any way in C
int a,b,c;
cin< cin< for(b=0;b<=c;b++)
{
c = a*b;
cout>>a"*"b"="c;
}

2006-11-23 05:25:40 · answer #4 · answered by eyewinkler 2 · 0 1

fedest.com, questions and answers