请问如何限制n的次数为5?
#include <stdio.h>void main() {
int c,n;
double num1,result;
char option;
/*printf("The number of conversions to be performed");*/
scanf("%d",&n);
for(c=1;c<=n;c++){
/*printf("%d",c);*/
scanf(" %c",&option);
scanf(" %lf",&num1);
switch (option) {
case '1':result=num1*0.3048;
printf("\n%.2lf feet equivalent to %.2lf meters\n",num1,result);
break;
case '2':result=num1*1.852;
printf("%.2lf nautical miles equivalent to %.2lf kilometers\n",num1,result);
break;
case '3':result=num1*0.016387;
printf("%.2lf cubic equivalent to %.2lf liters\n",num1,result);
break;
case '4':result=num1*4.54609;
printf("%.2lf gallons equivalent to %.2lf liters\n",num1,result);
break;
case '5':result=num1*4046.8564;
printf("%.2lf acers equivalent to %.2lf square meters\n",num1,result);
break;
case '6':result=num1*0.4535924;
printf("%.2lf pounds equivalent to %.2lf kilograms\n",num1,result);
break;
case '7':result=num1*1016.0469;
printf("%.2lf tons equivalent to %.2lf kilograms\n",num1,result);
break;
case '8':result=num1*745.7;
printf("%.2lf horsepower equivalent to %.2lf watts",num1,result);
break;
case '9':result=num1*1.01387;
printf("%.2lf horsepower equivalent to %.2lf metric horsepower",num1,result);
break;
}
}
}
请问如何限制n的次数为5?
也就是最多能转换5次。谢谢