DEV Community

IT_programer_developer
IT_programer_developer

Posted on

do{}while()_c++;

1.

int main()
{
    int son;

    cin>>son;
    int i=1;

    do
    {
        cout<< son <<"*"<<i<<"="<<son*i<<endl;
        i++;
    }
    while(i <= 10);

}
Enter fullscreen mode Exit fullscreen mode
int main()
{
    int son,i=1;

    cin>> son;

    while(1 <= 10)
    {
        cout<<son <<"*"<< i << "="<<son*i<<endl;
        i++;
    }
}
Enter fullscreen mode Exit fullscreen mode

*bu kodda avval biz int toifasida son degan ozgaruvchi yaratib olyapmiz va uni cin qilib console da oqiyapmiz keyn do bilan statement yani son,qowtirnoq ichida kopaytiruv belgisi,i,ten belgisi va son kopaytirilgan i ni chiqar deyapmiz yozyapmiz va while bilan shart beryapmiz agar aks holda i ondan kichkina yoki teng bolsa deyapmiz bunda birinchi bolib kompyuter do ni oqib olayapti va chiqaryapti keyn while da berilgan shart togri bolsa yana do kiryapti aks holda avtomaticheskiy koddan chiqib ketadi do while ni oddiy while dan farqi shundaki while da shart true bolsa kiradi aks holda yoq do while da esa 1marta bolsa ham statementni chiqarib keyn flase bolsa koddan chiqib ketadi *

Top comments (1)

Collapse
 
yaxyotojiboyev profile image
IT_programer_developer

maqola yoqqan bolsa like va komentariya yozishni unutmang!