Wap to print Series : 1 11 111 1111.....

/*write a c program to n terms of the folllowing series
1,11,111,1111,.....*/

#include<stdio.h>
#include<conio.h>

void main()

{
	int n,i,j;
	clrscr();
	printf("enter value of n:");
	scanf("%d",&n);
	printf("\nthe series ");
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=i;j++)
		{
			printf("1");
		}
		if(i<n)
			printf(",");
		else
			printf("");
	}
	getch();
}

No comments:

Post a Comment