#include #define KISIRLASTIRMA_UCRETI 5000 #define BIRTHS_PER_YEAR 2 // Köpeklerin yılda iki kez doğum yapması #define AVERAGE_LITTER_SIZE 6 // Her doğumda ortalama yavru sayısı #define INITIAL_DOG_POPULATION 10000000 // Başlangıç köpek popülasyonu #define MATURITY_AGE 1 // Cinsel olgunluğa ulaşma yaşı (yıl) void print_large_number(double number) { if (number <= -1e9) { printf("%.2f milyar TL", number / 1e9); } else if (number <= -1e6) { printf("%.2f milyon TL", number / 1e6); } else if (number >= 1e9) { printf("%.2f milyar TL", number / 1e9); } else if (number >= 1e6) { printf("%.2f milyon TL", number / 1e6); } else { printf("%.0f TL", number); } } int main() { int years; double total_cost = 0.0; // Kullanıcıdan simülasyon süresini al printf("Simülasyon süresini (yıl) girin: "); scanf("%d", &years); int current_dog_population = INITIAL_DOG_POPULATION; int new_puppies_per_year[years + MATURITY_AGE]; // Initialize new puppies array to 0 for (int i = 0; i < years + MATURITY_AGE; i++) { new_puppies_per_year[i] = 0; } for (int year = 0; year < years; year++) { int new_puppies = current_dog_population * BIRTHS_PER_YEAR * AVERAGE_LITTER_SIZE; // Add the new puppies to the year they will reach maturity if (year + MATURITY_AGE < years + MATURITY_AGE) { new_puppies_per_year[year + MATURITY_AGE] += new_puppies; } // Kısırlaştırma maliyetini topla total_cost += new_puppies * KISIRLASTIRMA_UCRETI; // Mevcut köpek popülasyonunu güncelle current_dog_population += new_puppies_per_year[year]; printf("Yıl %d: Toplam köpek sayısı = %d, Yıllık kısırlaştırma maliyeti = ", year + 1, current_dog_population); print_large_number(new_puppies * KISIRLASTIRMA_UCRETI); printf(", Toplam kısırlaştırma maliyeti = "); print_large_number(total_cost); printf("\n"); } printf("Toplam kısırlaştırma maliyeti: "); print_large_number(total_cost); printf("\n"); return 0; }