Pages

Wednesday, March 26, 2025

Print square patterns using for loop in C++

 #include <iostream>

using namespace std;
int main(){
   
    for(int i = 1; i <= 5; i++){

        cout << "****" << endl;

        /* MyLearnings:- cout << i << "****" << endl; -> this will print value of i +patterns
so keep in mind. */
    }

    return 0;
}


No comments:

Post a Comment

3917. Count Indices With Opposite Parity (Brute Force) O(n2) + Optimized Solution O(n) + tips LEETCODE WEEKLY 500

  class Solution {     public int [] countOppositeParity ( int [] nums ) {          // approach 1 - checks every pair         int n = n...