MindTree Pattern Programs with Answers

MindTree Coding Pattern Programs, MindTree Pattern Questions, MindTree Pattern Programs, MindTree Coding Pattern Questions

MindTree Pattern Questions based Programs with Answers

Program in C for MindTree Pattern

#include
int main()
{
int i,j,n,count=0,k=0;
printf(“Enter N”);
scanf(“%d”,&n);
for(i=1;i<=n;i++)

count=k;
for(j=1;j<=i;j++)

if(i%2==0)
{
printf(“%d”,count+i);
count=count-1;
if(j!=i)printf(“*”);
k++;
}
else
{
count=count+1;
printf(“%d”,count);
if(j!=i)printf(“*”);
k++;
}
}
printf(“\n”);
}
return 0;
}

Program in Java for MindTree Pattern

import java.io.*; 
import java.net.*; 
public class Selenium_Projext { 
public static void main(String[] args){ 

PrintPat(9); 
}

public static void PrintPat(int a)
{ int last=0;
for(int i=1;i<=a;i++)
{ last=last+i;
int l=i;

for(int j=last;l>0;l–)
{

System.out.print(j–);
if(l>1)
System.out.print(“*”);

}

System.out.println();
}
}}