Re-design and re-implement program such that only one while loop is used to dete
ID: 3669211 • Letter: R
Question
Re-design and re-implement program such that only one while loop is used to determine all even and odd numbers between 50 and 100. Again, print all even numbers on a single line, separated by commas, and all odd numbers on a new line, separated by commas. Use proper label for the outputs as shown in the example below and do not print a comma after the last number (or before the first number) on each line. Line up the outputs after the labels as shown below. Even numbers between 50 and 100: 50, 52, 54, 56, 58, 60, 62, 64. I cant use arrays only one while loop thanks.
Explanation / Answer
#include<stdio.h>
main()
{
int n=50;
while(n<=100){
printf("all even add numbers between 50 and 100 : ");
if(n%2==0){
printf("even numbers are %d, ",&n){
}else{
printf("odd numbers are %d, ",&n)
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.