Let’s understand some concept..
Table is made by multiplication of one repeat number &another is changed from 1 to 10. So, in these code, table is made by using loop method. Take example..
- 2*1=2
- 2*2=4
- 2*3=6
- 2*4=8
- 2*5=10
- 2*6=12
- 2*7=14
- 2*8=16
- 2*9=18
- 2*10=10
Repeated number is 2 and change number which changed by loop(‘while’, ‘do while’). You can write according to your need then you can start two loop. Example.. 1 one for repeated number and another for changed number.
Some important symbols used in code.
- () small bracket
- && use for ‘and’ use for address
- {} curly bracket
- “” double code

Nested of ‘while’ loop..
Table using ‘while’ loop of 2 to 20 number...
- #include<stdio.h>
- #include<conio.h>
- void main()
- {
- int a, b, c;
- clrscr();
- printf(“table from 1 to 20”);
- a=2;
- while(a<=20)
- {
- b=1;
- while(b<=10)
- {
- Printf(“%d”, a*b);
- }
- b++;
- }
- printf(“\n”);
- a++;
- getch();
- }
Result…

Table using ‘while’ loop of desired number…
- #include<stdio.h>
- #include<conio.h>
- void main()
- {
- int a, b, c;
- clrscr();
- printf(“Enter you desire number for table”);
- scanf(“%d”, &a);
- while(b<=10)
- {
- printf(“%d”, a*b);
- }
- b++;
- getch();
- }
Input..
If a=2; then
Result..

Table using ‘do while’ loop of desired number…

- #include<stdio.h>
- #include<conio.h>
- void main()
- {
- int a, b, c;
- clrscr();
- printf(“Enter your desire number”);
- scanf(“%d”, &c);
- do
- {
- a=c;
- Printf(“%d”, a*b);
- b++;
- }
- while(b<=10);
- getch();
- }
Input…
If the a=2; then
Result..



One Reply to “”