Write a complete program that includes the following three tasks: Write a for lo
ID: 3792137 • Letter: W
Question
Write a complete program that includes the following three tasks: Write a for loop to count and display integers starting at 0 and counting by 5's up through 100 (one per line) Write a do-while loop to output the countdown to the new year. The countdown starts at 10 and goes down to 1 (one per line), followed by "Happy New Year!" and a newline. Ask the user to enter a positive number, using the prompt "Enter a positive number: ". Then print a newline. Using a while loop, print out the message "You're doing great today!" the user selected number of times (once per line).
Explanation / Answer
Okay so the given 3 Conditions are being satisfied by the program given below:
As, no specific language is given, using c Programming language, the program is given.
Code: -
#include<stdio.h>
main()
{
int a=0;
int i,c;
int b=10;
for (i=0;i<=100;i=i+5)
{
printf("%d ",i);
a=a+1;
}
printf("No. of Integers between 0 to 100, at an interval of 5:%d (Including 0)",a);
do {
printf("countdown: %d ", b);
b=b-1;
}while( b >= 1 );
printf("Happy New Year! ");
printf("Enter a positive number:");
scanf("%d",&c);
for (i=1;i>=c;i++)
{
printf("You're doing great today! ");
}
}
This given program satisfies all the given 3 conditions in the question.
This is all for the given question.
Thank you for using Chegg...
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.