Friday, March 28, 2014

Print counting from 1 to 20 & there should be space between two numbers and after every five numbers line should be shifted to next line . Adopted method is to use the 'if' and 'else' statement

#include<stdio.h>
#include<stdlib.h>
void line()
{
int i,j;
printf("\n");
for(i=1;i<=42;i++)
printf("=");
}
void header()
{
printf("\n");
printf("Built and Designed by Arslan Malik\n\n www.CworldbyAS.blogspot.com");
printf("\n");
}
int main()
{
line();
header();
line();

int x=1;
printf("\n");
while (x<=20)
{
printf("%d",x);
if(x%5==0)
{printf("\n");}
else {printf("\t");}
x++;
}

return 0;
}

No comments:

Post a Comment