Skip to main content

Posts

Showing posts with the label Print Hello World!

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

In this easy coded program, you will learn how to print numbers from 1 up to the end decided by the user using while 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' (while Loop) /*Print Numbers from 1 to n- while loop*/ #include<stdio.h> void main () {     int i, num;     i =1 ;     printf( "Enter Number: " );     scanf( "%d" , & num);     while (i <= num)     {         printf( "%d \t " ,i ++ );     } } Output Enter Number : 7 1 2 3 4 5 6 7 ------...

C Program to Print Table till 10

In this easy coded program, you will learn how to print table till 10. You will not have to take any input from the user for this program. Similarly, you can print table till any number by minor modifications in this program. Try doing them for self practice. --------------------------------------------------------------------------- Program to Print Table till 10 /*Table till 10*/ #include<stdio.h> void main () {     int num, i, j, a;     j =1 ;     while (j <=10 )     {             for (i =1 ; i <=10 ; i ++ )         {             a = j * i;        ...

C Program for Division of Two Numbers(2 Variables)

In this easy coded program, you will learn how the division of two numbers takes place using two variables. Actually, using less variables is preferred the most wherever possible. Rather, the same program can also be solved using three variables. --------------------------------------------------------------------------- Program for Division of Two Numbers /*Division of Two Numbers using Two Variables*/ #include<stdio.h> void main () {     float a, b;     printf( "Enter Two Numbers: " );     scanf( "%f %f" , & a, & b);     printf( " \n The Division of %f and %f is %f." , a, b, a / b);     /*You can exclude the step below.*/     printf( " \n i.e. %f/%f=%f" , a, b, a / b); }   Output Enter Two Numbers : 22 7 The Division...