Table in C language….

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(for). 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
  • #include<stdio.h>
  • #include<conio.h>
  • void main()
  • {
  • int a, b, c;
  • clrscr();
  • printf(“table from 2 to 20”);
  • for(a=1; a<=20; a++)
  • for(b=1;b<=10;b++)
  • printf(“%d\t”,a*b );
  • getch();
  • }

Input….

If a=2 to 20;

Result..

Your Choice number by scanf…

  • #include<stdio.h>
  • #include<conio.h>
  • void main()
  • {
  • int a, b, c;
  • Printf(“Enter the choice number”);
  • Scanf(“%d”, &a);
  • for(b=1;b<=10;b++)
  • printf(“%d”, a*b);
  • getch();
  • }

Input..

If choice number is =2

Result…

Write table upto you want..

  • #include<stdio.h>
  • #include<conio.h>
  • void main()
  • {
  • int a, b, i;
  • clrscr();
  • print(“Enter your number upto you want to write table”);
  • scanf(“%d”, &a);
  • for(i=1;i<=a;i++)
  • For(b=1;b<=10;b++);
  • Printf(“%d\t”, i*b);
  • getch();
  • }

Inputs…

If a=2 and upto 20 or any

Result…

Table with their multiplication..

  • #include<stdio.h>
  • #include<conio.h>
  • void main()
  • {
  • int a, b, c;
  • clrscr();
  • printf(“Enter you choice number”);
  • scanf(“%d”, &a);
  • for(b=1;b<=10;b++)
  • printf(“%d * %d = %d”, a, b, a*b);
  • getch();
  • }

Inputs..

If a=2;

Result….

Table in C laTable in C language using ‘while’ & ‘do while’.

Design a site like this with WordPress.com
Get started