Search This Blog

Friday, October 7, 2011

Write a program to enter an interger num n from the keyboard and test if it lies in the range of 10 to 30(10<n<30)

 

   1:  #include<stdio.h>
   2:  #include<conio.h>
   3:  void main()
   4:  {
   5:  int n;
   6:  clrscr();
   7:  printf("Enter an int num:");
   8:  scanf("%d",&n);
   9:  if(n>=10)
  10:      if(n<=30)
  11:      printf("Number %d lies in the range 10 to 30\n",n);
  12:      else
  13:      printf("Number %d is more than 30\n",n);
  14:  else
  15:  printf("Number %d is less than 10\n",n);
  16:  getch();
  17:  }

No comments:

Post a Comment