design print 1

To print following design -
enter a name , like 'sujan' . Press enter button , and a design will appear like
s
su
suj
suja
sujan
program -
‪#‎include‬<stdio.h>
#include<string.h>
#include<conio.h>
void main()
{
int con,i,j;
char ch[100];
do
{
clrscr();
printf("enter a name = ");
gets(ch);
for(i=0;ch[i]!='\0';i++)
{
for(j=0;j<=i;j++)
{
printf("%c",ch[j]);
}
printf("\n");
}
printf("\ndo you want to continue ? Press 1 \n");
scanf("%d",&con);
}while(con==1);
getch();
return;
}
lets try this ......

Post a Comment

0 Comments