#include "stdafx.h"
#include <stdio.h>//i/o
#include <conio.h> //_getch()
#include <ctype.h> //toupper
int main()
{
long i,n;
float cost, p,buf;
do
printf("Vvedite pervonachalnuy stoimost : ");scanf_s("%f",&cost);
printf("Vvedite procent p % : ");scanf_s("%f",&p);
printf("Vvedite n chisl Let : ");scanf_s("%u",&n);
for(i = 0; i < n; i++)
printf("Let %u\r\n",i + 1);
buf = cost*p/100;
printf("Stoimost za zimmu + : %f\r\n",(cost += buf));
printf("Stoimost za zimmu -: %f\r\n",(cost -= buf));
}
printf("Stoimost %u Let %f\r\n",i,cost);
printf("Najmite Y - new input\r\n");
while(toupper(_getch()) == 'Y');
return 0;
#include "stdafx.h"
#include <stdio.h>//i/o
#include <conio.h> //_getch()
#include <ctype.h> //toupper
int main()
{
long i,n;
float cost, p,buf;
do
{
printf("Vvedite pervonachalnuy stoimost : ");scanf_s("%f",&cost);
printf("Vvedite procent p % : ");scanf_s("%f",&p);
printf("Vvedite n chisl Let : ");scanf_s("%u",&n);
for(i = 0; i < n; i++)
{
printf("Let %u\r\n",i + 1);
buf = cost*p/100;
printf("Stoimost za zimmu + : %f\r\n",(cost += buf));
buf = cost*p/100;
printf("Stoimost za zimmu -: %f\r\n",(cost -= buf));
}
printf("Stoimost %u Let %f\r\n",i,cost);
printf("Najmite Y - new input\r\n");
}
while(toupper(_getch()) == 'Y');
return 0;
}