hi guys got a question here how can you display output 1 to 35 in a variable declared with the value of 1 (a=1; with the condition of 1>100 ??? in a for loop structure

sorry if i dont make sense guys..

im kinda new to this thing

Recommended Answers

All 9 Replies

are you trying to display 1 to 53 numbers on screen as an output of your program?please explain a little bit more..

i need to display 1 to 35 numbers as an output...with the condition of 1 to 100

sorry if i dont make sense again

you can use one more variable "counter" in for loop in which you can set the condition till 35 so that if that variable goes to increase from 35 than the condition goes to false any numbers from 1 to 35 will be printed

oh,i kinda get what you were saying, but can you give an actual example??
if its ok with you

ya you can try for this-
int count=1
for(int i=1;i<100;i++)
{
if (count<35)
{
SOP(count);
count++;
}
exit;
}
i hope it helps you..

ok tnx again :)...im going to try it :)

i hope it works

hehe...

IF YOU WANT TO PRINT ! TO 35. tHEN THE PROGRAM WILL BE

for(i=0;i<=35;i++)
cout<<i;

Your question is not clear to me.
Please submit what you have tried.

cout<<i is c++ not Java

if you need to have the conditions of 1 - 100

for (int i = 1; i <= 100; i++){ // loops from 1 - 100
  if (i <=35){ // checks if it is between 1 and 35
    System.out.println (i); // prints out the number
  }
}

Yea sirlink99 , you are right.
I only have given the logic.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.