Write a program in C++ to perform following pattern. - Pratik Ghelani

Pratik Ghelani

Breaking

Sunday, January 20, 2019

Write a program in C++ to perform following pattern.

Write a program in C++ to perform following pattern:

3 5 
7 9 11 
13 15 17 19

Program:-

#include<iostream>
using namespace std;
int main() 

    int i,j,num=-1; 
    
    for(i=1;i<=4;i++) 
    { 
        for(j=1;j<=i;j++)
        { 
            num=num+2;
            cout<<num;
            cout<<" "; 
        } 
        cout<<endl; 
    }
    

}

Output:-





No comments:

Post a Comment