Skip to main content

Posts

Showing posts with the label Print Table of 2

C Program to Print Numbers from 1 to 'n' (for Loop)

In this easy coded program, you will learn how to print numbers from 1 up to the end decided by the user using for loop. You will have to take input of the last number that the user wants to print and simply write the code for its execution. --------------------------------------------------------------------------- Program to Print Numbers from 1 to 'n' (for Loop) /*Print Numbers from 1 to n- for loop*/ #include<stdio.h> void main () {     int i, num;     i =1 ;     printf( "Enter Number: " );     scanf( "%d" , & num);     for (; i <= num; i ++ )     {         printf( "%d \t " ,i);     } }   Output Enter Number : 7 1 2 3 4 5 6 7...

C Program to Print Table till 'n'

In this easy coded program, you will learn how to print table till 'n'. You will have to take input of the number which will tell the compiler up to where it has to print the table(s). --------------------------------------------------------------------------- Program to Print Table till 'n' /*Table till n*/ #include<stdio.h> void main () {     int num, i, j, a;     j =1 ;     printf( "Enter Number: " );     scanf( "%d" , & num);     while (j <= num)     {             for (i =1 ; i <=10 ; i ++ )         {             a = j * i; ...

C Program to Print Table of 'n'

In this easy coded program, you will learn how to print table of n. You will have to take input from the user for this program of any number of which the table needs to be calculated. --------------------------------------------------------------------------- Program to Print Table of 'n' /*Table of n*/ #include<stdio.h> void main () {     int num, i, a;     printf( "Enter Number: " );     scanf( "%d" , & num);     for (i =1 ; i <=10 ; i ++ )     {         a = num * i;         printf( " \n %d X %d = %d" , num, i, a);     } }   Output      Enter Number : 7 7 X 1 = 7 7 X 2 = 14 7 ...

C Program to Print Table of 2

In this easy coded program, you will learn how to print table of 2. You will not have to take any input from the user for this program. Similarly, you can print table of any number by minor modifications in this program. Try doing them for self practice. --------------------------------------------------------------------------- Program to Print Table of 2 /*Table of 2*/ #include<stdio.h> void main () {     int i, a;     for (i =1 ; i <=10 ; i ++ )     {         a =2* i;         printf( " \n 2 X %d = %d" , i, a);     } } Output      2 X 1 = 2 2 X 2 = 4 2 X 3 = 6 2 X 4 = 8 2 X 5 = 10 2 X 6 = 12 2 X 7 = 14 2 X 8 = 16 2 X 9 = 18 2 X 10 = 20   ---------------...