Write on algorithm to find odd number upto 20
Answers
Answered by
0
Answer:
public class Main
{
public static void main(String[] args) {
for(int i = 0; i < 20; i++){
if(i%2==1){
System.out.println(i);
}
}
}
}
Explanation:
Answered by
2
Start
Step 1: Let an integer i=1
Step 2: if i<20 then go to step 3 otherwise go to end
Step 3: if i%2=1 then go to step 4 otherwise go to step 5
Step 4: print i
Step 5: i=i+1 go to step 2
End
Step 1: Let an integer i=1
Step 2: if i<20 then go to step 3 otherwise go to end
Step 3: if i%2=1 then go to step 4 otherwise go to step 5
Step 4: print i
Step 5: i=i+1 go to step 2
End
Similar questions