The underline one is need to printout the price per KGs..Code:#include<stdio.h> #include<string.h> struct infor{ char name[20]; int age; char sex[6]; }; struct center{ char *comname; char *address; char *phone; }; float get_kilogram(float KiloGram) { float Cost; if(KiloGram < 3.00) Cost = KiloGram * 1.20; else if(KiloGram >= 3.00 && KiloGram <= 6.00) Cost = KiloGram * 1.00; else Cost = KiloGram * 0.80; return Cost; } int main (void) { struct infor INFO; struct center ctr; float Kgs,Price; ctr.comname = "UNIVERSITY TUNKU ABDUL RAHMAN"; ctr.address = "Universiti Tunku Abdul Rahman,\n\tP.O.BOX 11384, 50744 Kuala Lumpur, Malaysia"; ctr.phone = "Tel: (+6)03-79582628"; printf("Please Enter Customer's Name:\n"); scanf("%s", &INFO.name); printf("Please Enter Customer's Age:\n"); scanf("%d", &INFO.age); printf("Please Enter Customer's Sex:\n"); scanf("%s", &INFO.sex); printf("Please Enter Customer's Laundry Weight (In KG(s))\n"); scanf("%f", &Kgs); Price = get_kilogram(Kgs); printf("\t\t%s", ctr.comname); printf("\n"); printf("\t\t%s", ctr.address); printf("\n"); printf("\t\t%s", ctr.phone); printf("\n"); printf("Customer's Name : %s\n", INFO.name); printf("Customer's Age : %d\n", INFO.age); printf("Customer's Sex : %s\n", INFO.sex); printf("Price Per Kilogram(s) : \n");:confused: printf("Payment : RM%.2f\n", Price); return 0; }
but i cant called it out from the if else function prototype...
could someone advice me??