DEV Community

Rivojiddin
Rivojiddin

Posted on

foundationda 5 - dars

bu cod 5 honali sonni yaxlitlab beradi masalan input; 13900,
yozilsa 14000 chiqazadi.

int main (){
    int son ;
    cin >> son;

    float newSon = son;
    cout << round(newSon / 1000) * 1000;

    return 0;
}
Enter fullscreen mode Exit fullscreen mode

bu cod biror sonni necha soat , necha minut , necha soniya ekanligini chiqazib beradi.

int main (){
    int seconds;
    cin >> seconds;
    cout << setw(2) << setfill ('0') << seconds / 3600 << ":"; 
    cout << setw(2) << setfill ('0') << seconds % 3600 / 60 << ":"; 
    cout << setw(2) << setfill ('0') << seconds % 60 << ":"; 

    return 0;

}
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
axmadov_abu profile image
AxmadovAbdulatif

zo'r