KleptsovKD 3 месяцев назад
Родитель 215170e1f1
Сommit 1c1a190c47

3
Project/.gitignore поставляемый

@ -0,0 +1,3 @@
/Project.depend
/bin
/obj

@ -3,6 +3,46 @@
int main()
{
printf("Hello world!\n");
double A, C, p;
printf("Enter the initial cost of the product: ");
scanf(" %lf", &A);
printf("Enter the desired cost of the product: ");
scanf(" %lf", &C);
while(A <= C)
{
printf("The initial cost is already lower or equal to the desired one. \nEnter the desired one again: ");
scanf(" %lf", &C);
}
printf("Enter the percentage reduction in the cost of the product for the year: ");
scanf(" %lf", &p);
//printf("A = %lf \nC = %lf \np = %lf \n", A,C,p);
for(int i = 1; i <= 10; i++)
{
A *= (1 - (p / i) / 100);
printf("A = %lf\n", A);
if(A < C)
{
printf("The cost of the product dropped below the desired cost after %d years\n", i);
break;
}
}
if(A > C)
{
printf("The cost of the product did not fall below the desired cost\n");
}
printf("Press any key to exit...\n");
getchar();
getchar();
return 0;
}

Загрузка…
Отмена
Сохранить