+ 1

What can be the code of this pattern?

Pattern : * * * * * * * * * * * * * * * *

10th May 2018, 3:56 PM
Hamza Aziz
Hamza Aziz - avatar
2 Respuestas
10th May 2018, 4:13 PM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar
0
//Here you go #include<iostream> using namespace std; int main() { char ch = ' '; int n = 6; for(int i = 0; i <= n; i++) { for(int j= 0; j <= n*2; j++) { if(j < n) { if ( j <= n-i ) { std::cout<<ch; } else { std::cout<<"*"; } } else { if ( j >= n+i ) { std::cout<<ch; } else { std::cout<<'*'; } } } std::cout<<endl; } for(int i = 0; i <= n; i++) { for(int j= 0; j <= n*2; j++) { if(j < n) { if ( j <= i ) { std::cout<<ch; } else { std::cout<<"*"; } } else { if ( j >= (n+(n-i))) { std::cout<<ch; } else { std::cout<<'*'; } } } std::cout<<endl; } }
10th May 2018, 4:19 PM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar