Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(void)
- {
- int rooms,flat,porch,stage,balcony=2;
- printf("number of your flat\n");
- scanf("%i",&flat);
- if((flat>0)&&(flat<=128))
- {
- if(flat<=64) porch=1;
- else porch=2;
- printf("* %2i porch is yours\n",porch);
- if(porch==1) stage=(flat-1)/4+1;
- else stage=(flat-65)/4+1;
- printf("* %3i stage is yours\n", stage);
- int type;
- if(porch==1) type=flat-(stage-1)*4;
- else type=flat-(stage-1)*4-64;
- switch(type)
- {
- case 1:case 4:rooms=3;break;
- case 2:case 3:rooms=2;break;
- }
- printf("* There are %2i rooms in this flat\n", rooms);
- printf("* There are %2i balconies in this flat\n", balcony);
- }
- else
- printf("**Incorrect order**\n");
- system ("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement