Ad Code

Responsive Advertisement

1146 - Growing Sequences

Author: Ismail Hosen

Daffodil International University





Problem Link

//Please follow from main function

#include<stdio.h>

int main()

{

    int i,x,count=0;

    while(1)

    {

        scanf("%d", &x);

        if(x==0)

            break;



        for(i=1; i<=x; i++)

        {

            count++;

            if(x==count){

                printf("%d\n",i);

                count=0;

            }

            else{

                printf("%d ",i);

            }

        }

    }

    return 0;

}




Post a Comment

0 Comments