يدخل في حلقة لا نهائية
#include <stdio.h>
void main ()
{
int n;
int amount;
float Service_charge;
double Total_amount;
printf("Enter any number to continue or press 0 to stop:>");
scanf("%d",&n);
while(n !=0 ){
if(n==0)
break;
printf("\nEnter the amount:");
scanf("%d",&amount);
if(amount < 50){
Service_charge=1;
printf("Service charge $ %.2f",Service_charge);
printf("\n-------------------------------");
Total_amount=amount + Service_charge;
printf("\nTotal amount is $ %.2f",Total_amount);
printf("\n-------------------------------");}
else {
Service_charge = amount * 15/100;
printf("\nService charge $ %.2f",Service_charge);
printf("\n-------------------------------");
Total_amount=amount + Service_charge;
printf("\nTotal amount is $ %.2f",Total_amount);
printf("\n-------------------------------");
}
}
printf("Program end……….") ;
}