In this, we are going to see the do-while loop, the program is based on the do-while loop which basically Prints numbers in reverse order with the help of the C Programming language.Â
#include <stdio.h>
int main()
{
int m, n;
printf("To print values from m to n in reverse order \n(Note : m must be GREATER than or EQUAL to n)\n");
printf("Enter value of m :\n");
scanf("%d", &m);
printf("Enter value of n :\n");
scanf("%d", &n);
do
{
if (m >= n)
{
printf("%d ", m);
m--;
}
else
{
printf("You have enterd Invalid values for m or n, or both\n(Note : m must be GREATER than or EQUAL to n)");
break;
}
} while (m >= n);
return 0;
}
//..........Coded by ARADHANA MISHRA
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP