My issue
im not getting answer for this at all can you help me with code
My code
#include <iostream>
using namespace std;
void printWavePattern(int N) {
int width = N * 4 - 1; // Total width of the pattern
for (int i = 0; i < N; i++) {
for (int j = 0; j < width; j++) {
if ((i == 0 || i == N-1) && (j % 4 == 0 || j % 4 == 1)) // First & Last row pattern
cout << "*";
else if (i == 1 && j % 4 == 2) // Middle row pattern (diagonal)
cout << "*";
else
cout << " ";
}
cout << endl;
}
}
int main() {
int N;
cin >> N;
printWavePattern(N);
return 0;
}
Learning course: Learn Programming and Problem Solving using C++
Problem Link: https://www.codechef.com/learn/course/sit-cpp-fall/SITFALL64/problems/CPPFALL466