# how to do this currency conversion

• 02-22-2010
rashid
how to do this currency conversion
hello gents
I am a beginner for the last 15 years as I do little bit of programming for a month and then give up on C-programming
Here is my homework and is little frustrating for my ignorance and asking too..
I need to in this code below..
If curr(currency) selection is if 0>curr<6 then printf("error: please enter between 1 to 5 for selection and then proceed with calculation of currency conversion\n")

How do I do this as when I enter 6(not acceptable) it proceeds to switch/case
part(why?)
but it should only proceed to switch/csae till the input(curr) is between 1 to 5
HOW ?? can someone read my code and see what can be done

Code is attached with some explanations too in the code
• 02-22-2010
```   do {     printf("Please Enter 1 to 5 for the Above World Currency \n"    );     /*printf("you want the : \n");*/     scanf("%d", &curr);     getchar();   }while((curr < 1) || (curr > 5));```
```#include<stdio.h> int main() {         int a ;         while(1)         {         scanf("%d",&a);         switch(a>0&&a<6)         {                 case 0:                         printf("Please enter a valid number \n");                         break ;                 default :                         break ;         }} }```