Pages

Thursday, March 27, 2025

code for user to enter value any number , if multiple of 10, code stops in C++

 #include <iostream>

using namespace std;
// code for user to enter value any number , if multiple of 10, code stops in C++
int main(){
    int num;

    do{
        cout << "enter a number : ";
        cin >> num;
        if(num % 10 == 0){
            break;
        }
        cout << "you entered " << num << endl;
    } while(true); // this is a infinite loop of do-while loop (code is excluded)
   
   
    cout << "you entered a multiple of 10 number. byeee....";
    return 0;

}

No comments:

Post a Comment

Stack using Linked List – Partial (University Exam Topic)

 #include <iostream> using namespace std; struct Node {     int data;     Node* next; }; class Stack {     Node* top; public:     Stac...