patternprogram_412 softethics

Pattern 412 (String Pattern)

C

#include <stdio.h>
#include <string.h>

int main()
{
  //A char array to hold the string and print a single char at a time.

  char arr[]="SUMIT";

  int len=strlen(arr);
  int i,j;

  for (i=0; i<len; i++)
  {
    for (j=0; j<=i; j++)
    {
      printf("%c ",arr[j]);
    }
    printf("\n");
  }

  return 0;
}

C++

Java

C#

Python

5 1 vote
Rate this Program
Subscribe
Notify of
guest


0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments