Alternative Square Pattern Problem Code: SQALPAT

Output is correct but after submission its showing wrong answer.
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int n=1;
if(a>=1 && a<=200)
{
for(int i=0;i<a;i++)
{
for(int j=0;j<5;j++)
System.out.print(n++ +" ");
System.out.println();
}

It isn’t altering

#include
using namespace std;

int main() {
int n;
cin>>n;
int sumi = 0, sumj = 10;
for(int i=1; i<=n; i++){
if(i%2!=0){
for(int j=sumi+1; j<=sumi+5; j++){
cout<<j<<" “;
}
cout<<endl;
sumi = sumi + 10;
}else{
for(int j=sumj; j>=sumj-4; j–){
cout<<j<<” ";
}
cout<<endl;
sumj = sumj + 10;
}
}
return 0;
}

can u explain how you did this problem.

very nice, but it will be better to understand if you put indentation.

Sure screenshot will be shared