Get Email Subscription

Enter your email address:

Delivered by FeedBurner

Wednesday, March 10, 2010

To display the numbers in the series, only 7 numbers per line

To display a series of numbers as 1 2 3 4 .......... 100. Display only five integers per line.


#include<stdio.h>
#include<conio.h>
void main( )
{
int j, p=0;
for (j=1; j < = 100, j++)
{
printf("%d", j);
p++;
if (p==7)
{
printf("\n");
p=0;
}
}
}

Hint:-


Method used in previous question can not be used
here. That method can be used only if 80 divided by
number of values per line gives you integer answer
otherwise you have to use 2nd Method.
7 values per line = 80/7 = 11.43 and
therefore you can not use the earlier method.

Related Posts by Categories



0 comments:

About This Blog

Lorem Ipsum

  © Blogger templates Newspaper III by Ourblogtemplates.com 2008

Back to TOP