Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
May 30, 2022 12:05 pm GMT

C. Loopga doir masalalar. Yulduzchalar.

Yulduzchalar yordamida *diamond shape * chop etish.

Natija:

      *     ***    *****   *******  ********* ************************ ***********  *********   *******    *****     ***      *

Kod:

#include<iostream>using namespace std;int main(){    int i, j, rowNum, space;    cout<<"Enter the Number of Rows: ";    cin>>rowNum;    space = rowNum-1;    for(i=1; i<=rowNum; i++)    {        for(j=1; j<=space; j++)            cout<<" ";        space--;        for(j=1; j<=(2*i-1); j++)            cout<<"*";        cout<<endl;    }    space = 1;    for(i=1; i<=(rowNum-1); i++)    {        for(j=1; j<=space; j++)            cout<<" ";        space++;        for(j=1; j<=(2*(rowNum-i)-1); j++)            cout<<"*";        cout<<endl;    }    cout<<endl;    return 0;}

Savollar va takliflaringizni Telegram orqali qoldirishingiz mumkin.


Original Link: https://dev.to/dawroun/c-loopga-doir-masalalar-yulduzchalar-php

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To