0

I have to do this with "for" and "while" loop in c++ but no idea how

print all numbers between 10000 and 100 which are devisible with 5 and 9 but not with 2

any help suggestion advice or anything is needed urgently this is too complicated for me heelp

4
Contributors
5
Replies
41
Views
2 Years
Discussion Span
Last Post by Schol-R-LEA
0

the only thing i have on mind is to do

    for(int i=10000;i>=100;i--){


    if()
}

but no idea how to do the conditions am i write or wrong

0

oh i did this1 but i have 2 more
1. add number with cin and and collect all even numbers lower than the entered number
2. enter 2 numbers x an y with cin and print all numbers between the x and y which r divisable with 3
suggestions pls

0

To divide You may apply the condition like :

if(i%5==0 && i%9==0)
{
}

&& operator will help you to execute this statement if both of the conditions are true otherwise it may execute the else part where u can place an invalid message if the number is divisble by 2.

Edited by HōñËy

0
void display()
{
for (int i=100;i<100001;i++)
{
if (i%5==0 %% i%9==0)
cout<<i<<endl;
}
}
0

basit_3: While it is admirable that you want to help the OP out with the problem, it is generally not advisable to simply give the working code out willy-nilly, especially without any explanation. DaniWeb policy generally to give advice rather than solving problems outright.

Edited by Schol-R-LEA

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.