Monday, July 25, 2011

A C program that print 1 to 50 by FOR loop

This is a program in which we use the concept of "Nested FOR LOOP" for printing the numbers from 1 to 50 and 10 digits in each line.
C Program:-



#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int n,m;
for(n=1;n<=50;n+=10)
{
printf("\n\n");
for(m=n;m<n+10;m++)
printf("%d\t",m);
}
getch();
}

Output:-
                     This program uses the concept of nested for loop and nested means loop inside a loop now in that type of case first it takes 1 value of upper loop and then execute the whole loop inside its body then again return to take the another value so in that way numbers from 1 to 50 will be printed and and after 10 digits automatically comes to new line.

1 comment:

  1. Goyang Casino | Go to GoyangC | Ghana.com
    Goyang Casino is 바카라 a modern and secure gambling 바카라사이트 destination in Ghana. We're located in our small town of Goya, w88 a city full 포커 고수 of vibrant entertainment 포커 족보 and

    ReplyDelete