Hey guys, im new to the C language and i have a problem with loops.
I need to calculate the cost of buying carpets to n houses, every house consists of n rooms, and every room consists of different length and width.
for this i made a loop:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
while (i <= rn)
{
printf("please enter the lenght of room number %d:",i);
scanf("%f",&l);
printf("please enter the width of room number %d:",i);
scanf("%f",&w);
printf("please enter the color of room number %d:",i);
fflush(stdin);
scanf("%c",&c);
/*in the second run of the loop, it doesn't allow users to type, it steps over the scanf statments*/
..
..
..
..
what's the problem and every loop in this program steps over scanfs in the second run :S