Write an algorithm to find the even number 2 to 50 .
Answers
Answered by
1
Answer:
1). use for loop
2). i=2
3). i<=50
4). i++
5).inside for body
if(i%2==0)
then
print even number
end if
6). end for loop
Explanation:
for(int i=2 i<=50; i++){ /*start from 2 to 50 time
execute this loop*/
if(i%2==0){ /*then use this if statement for find
even number if i is divisible by 2 and get reminder equal to 0 then our number is even*/
cout<<i; // display number
}
cout<<endl; // brick the statement
}
Similar questions