In this program, you'll learn to print diagonal star pattern.
#include <iostream>
using namespace std;
int main()
{
int i,j;
for (i=0; i<5; i++)
{
for (j=0; j<5; j++)
{
if (i==j)
{
cout<<"* ";
continue;
}
cout<< " ";
}
cout<< "\n";
}
return 0;
}
*
*
*
*
*