Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

what is problem? this program about Multiple numbers

+3 votes
asked Dec 21, 2022 by amadeus (150 points)
#include <iostream>
using namespace std;
int main(){
    int a,b,c;
        a=0;
        b=100;
    cin>>c;
        cout<<"enter number";
        
        a=a+1
        while a<b ;
        if a%c==0;
        print(a)
        a=a+1
        else
        a=a+1
        if a<b
        print (a)
    
        return 0;
        
}

2 Answers

+1 vote
answered Dec 21, 2022 by shah pallav (160 points)

here you need to write "cout<<"enter number";" first then after you should write " cin>>c;"

0 votes
answered Dec 23, 2022 by Peter Minarik (87,340 points)

What is your program supposed to do?

Follow the error messages output by the compiler and fix them one by one.

You have way too many problems to get your code fixed up in a meaningful way. You have:

  • missing semicolons from the ends of lines
  • infinite loops (no values increment so the condition will always be true; or you just added a semicolon at the end of the loop)
  • your scopes are not well-defined. Are you coming from Python? In C/C++/C#/Java scopes are defined between opening and closing curly braces: {, }
  • print is not a valid function in C++
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...