Here is a question asked in Amcat Automata paper to Obtain a output as follows:
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
11 12 13 14 15
7 8 9 10
4 5 6
2 3
1
Amcat Automata Paper solution
Here is a C program code of the above question.
#include <stdio.h>
int main()
{
int i ,j,t ,k=0,n=5,arr[20];
for(i=1;i<=n;i++)
{
t=k+1;
for(j=1;j<=i;j++)
{k++;
printf(“%d”,k);
}printf(“n”);
}
for(i=1;i<=n;i++)
{
for(j=n-i+1;j>0;j–)
{
arr[j]=k;
k–;
}
for(j=1;j<=n-i+1;j++)
{
printf(“%d”,arr[j]);
}
printf(“n”);
}
return 0;
}
Also read:
- Recent Automata AMCAT questions answers
- AMCAT Automata Important questions 2015
- The best answer to AMCAT automata 2015
Thank you for reading.