#include <stdio.h>
#include <string.h>
int main()
{
char arr[] = "SUMIT";
int n = strlen(arr);
int i,j,k;
for(i = 0; i < n; i++)
{
for(j = i; j > 0; j--)
{
printf(" ");
}
for(k = 0; k < n - i; k++)
{
printf("%c ", arr[k]);
}
printf("\n");
}
return 0;
}
#include <iostream.h>
#include <string.h>
int main()
{
char arr[] = "SUMIT";
int len = strlen(arr);
for(int i = 0; i < len; i++)
{
for(int j = i; j > 0; j--)
{
cout<<" "; // 2ws
}
for(int k = 0; k < len - i; k++)
{
cout<<arr[k]<<" ";
}
cout<<endl;
}
return 0;
}
class PatternProg
{
public static void main(String args[])
{
String arr = "SUMIT";
int len = arr.length();
for (int i = 0; i < len; i++)
{
for (int j = i; j > 0; j--)
{
System.out.print(" "); //2ws
}
for (int k = 0; k < len - i; k++)
{
System.out.print(arr.charAt(k)+" ");
}
System.out.println();
}
}
}
using System;
class PatternProg
{
public static void Main()
{
string arr = "SUMIT";
int len = arr.Length;
for (int i = 0; i < len; i++)
{
for (int j = i; j > 0; j--)
{
Console.Write(" "); //2ws
}
for (int k = 0; k < len - i; k++)
{
Console.Write(arr[k] + " ");
}
Console.WriteLine();
}
Console.ReadKey(true);
}
}
string = "SUMIT"
length = len(string)
for x in range(0, length):
for y in range(x, 0, -1):
print(" ", end="") # 2ws
for z in range(0, length - x):
print(string[z] + " ", end="")
print()