Write a program for this pattern
Attachments:
Answers
Answered by
0
Jack o'clockgheaviesvyqwg
Answered by
0
Answer:
see your ans given below...
Explanation:
#include<stdio.h>
#include<string.h>
void main()
{
char patt[10];
int row=0,col=0,len=0,spc=0,a=1;
//len= length of string arrray patt
printf("enter array elements \n");
scanf("%s",patt);
len=strlen(patt); //calculating length of array
for(row=len-1;row>=0;row--)
{
for(spc=1;spc<=a-1;spc++) //trailing spaces
{
printf(" ");
}
for(col=0;col<=row;col++)
{
printf("%c",patt[col]);
}
a=a+1;
printf("\n");
}
}
Attachments:
Similar questions