speedrunpolabam 1.3

Run Settings
LanguageC
Language Version
Run Command
#include <stdio.h> #include <locale.h> #include "header.h" int main() { setlocale(LC_ALL, ""); int n, floor, flatType, rooms, balconies; float floornum = 1; printf("Введите номер квартиры >>"); scanf("%d", &n); if (n > 0 && n <= 72) { floor = entrance(n, floornum); printf(" на этаже %d\n", floor); rooms = getRoomsCount(n); printf("Имеет %d комнат и ", rooms); balconies = getBalconiesCount(n); printf("%d балкон(а)", balconies); } else { printf("Квартиры с номером %d не существует", n); } return 0; }
#ifndef HEADER_H #define HEADER_H #define PUBLIC #define PRIVITE static PUBLIC int getRoomsCount(int n); PUBLIC int getBalconiesCount(int n); PUBLIC float entrance(int n, float floornum); #endif
#include <stdio.h> #include "header.h" #define NUMBEROFROOMS 4 PUBLIC int getRoomsCount(int n) { int rooms[4] = { 8, 9, 9, 8 }; return rooms[(n - 1) % NUMBEROFROOMS]; } PUBLIC int getBalconiesCount(int n) { int balconies[4] = { 2, 1, 1, 2 }; return balconies[(n - 1) % NUMBEROFROOMS]; } PUBLIC float entrance(int n, float floornum) { if (n < 36) { printf("Квартира находится в первом подъезде"); return floornum = ((n / 4.01) + 1); } else { printf("Квартира находится во втором подъезде"); return floornum = (((n - 36) / 4.01) + 1); } }
Editor Settings
Theme
Key bindings
Full width
Lines