Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(void)
  5. {
  6. int rooms,flat,porch,stage,balcony=2;
  7. printf("number of your flat\n");
  8. scanf("%i",&flat);
  9. if((flat>0)&&(flat<=128))
  10. {
  11. if(flat<=64) porch=1;
  12. else porch=2;
  13. printf("* %2i porch is yours\n",porch);
  14.  
  15. if(porch==1) stage=(flat-1)/4+1;
  16. else stage=(flat-65)/4+1;
  17. printf("* %3i stage is yours\n", stage);
  18.  
  19. int type;
  20. if(porch==1) type=flat-(stage-1)*4;
  21. else type=flat-(stage-1)*4-64;
  22. switch(type)
  23. {
  24. case 1:case 4:rooms=3;break;
  25. case 2:case 3:rooms=2;break;
  26. }
  27. printf("* There are %2i rooms in this flat\n", rooms);
  28.  
  29. printf("* There are %2i balconies in this flat\n", balcony);
  30. }
  31. else
  32. printf("**Incorrect order**\n");
  33. system ("pause");
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement