Learn C ProgrammingLearn ProgrammingLoop Control StructuresPrograms On Loop Control Structures While And Do-WhileResources

026. Write a Program to print numbers n to 1 using Do While loop in C language

By September 18, 2012 February 5th, 2018 No Comments
  1. #include<stdio.h>
  2. #include<conio.h>
  3. main()
  4. {
  5. int i=1,n;
  6. clrscr();
  7. printf("Enter n : ");
  8. scanf("%d",&n);
  9. i=n;
  10. do
  11. {
  12. printf("%d\t",i);
  13. i--;
  14. }while(i>=1);
  15. getch();
  16. }
#include<stdio.h>
#include<conio.h>   
main()
{
  int i=1,n;
  clrscr();
  printf("Enter n : ");
  scanf("%d",&n);
  i=n;
  do
  {
	   printf("%d\t",i);
	   i--;
  }while(i>=1);
  getch();
}

Leave a Reply

DEMO01