Advertisement
dllbridge

Untitled

Jan 2nd, 2023
1,264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.40 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9. #include <stdio.h>
  10.  
  11.  
  12.  
  13.  
  14. ///////////////////////////////////////////////////////////////
  15. int main()                                                   //
  16. {
  17.    
  18.     unsigned __int16 n = 32762;                                                  // 1 byte
  19.  
  20.     for(int i = 0; i < 11; i++)
  21.     {
  22.        
  23.         printf("n = %d \n", n++);
  24.     }
  25. }
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. /*
  50. #include <iostream>
  51. using namespace std;
  52.  
  53.  
  54. int          kol_vo,
  55.           price = 0;
  56.          
  57.          
  58.          
  59. void        start();                 //  Первая часть программы
  60. int     calc(int n);
  61.  
  62. ///////////////////////////////////////////////////////////////
  63. int main()                                                   //
  64. {
  65.  
  66.     start();
  67.    
  68.     int   delen = kol_vo / 7;
  69.     int ostatok = kol_vo % 7;
  70.  
  71.     price  = calc( 7)* delen;    
  72.     price += calc( ostatok );
  73.  
  74.     cout << "цена: " << price;
  75. }
  76.  
  77.  
  78.  
  79.  
  80. ///////////////////////////////////////////////////////////////
  81. void start()                                                 //
  82. {
  83.        
  84.     setlocale(LC_ALL, "Russian");
  85.    
  86.     cout << "Введите количество книг: ";
  87.     cin  >> kol_vo;
  88.    
  89. }
  90.  
  91.  
  92. ///////////////////////////////////////////////////////////////
  93. int calc(int n)                                              //
  94. {
  95.    
  96.     int p = 0;
  97.    
  98.     if( n < 8)
  99.     {
  100.         for(int i = 0; i < n; i++)
  101.         {
  102.             p += 1000 - 55 * i;
  103.         }
  104.     }  
  105.     else return -1;
  106.    
  107.          return  p;  
  108. }
  109.  
  110.  
  111.  */
  112.  
  113. /*#1
  114. #include <iostream>
  115. using namespace std;
  116.  
  117.  
  118.  
  119. ///////////////////////////////////////////////////////////////
  120. int main()                                                   //
  121. {
  122.    
  123.     setlocale(LC_ALL, "Russian");
  124.        
  125.     int      kol_vo,
  126.           price = 0;
  127.        
  128.    
  129.     cout << "Введите количество книг: ";
  130.     cin  >> kol_vo;
  131.  
  132.     if(kol_vo < 8)
  133.     {
  134.         for(int i = 0; i < kol_vo; i++)
  135.         {
  136.             price += 1000 - 55 * i;
  137.         }
  138.         cout << "цена: " << price;
  139.         return 0;
  140.     }
  141.  
  142.     if(kol_vo >= 8)
  143.     {
  144.         price = 2000;
  145.         for(int i = 0 ;i < kol_vo - 2 ; i++)
  146.         {
  147.             price += 1000 - (55 * i + 1);
  148.         }
  149.  
  150.         cout << "цена: " << price;
  151.     }
  152. }
  153.  
  154.  
  155.  
  156. */
  157.  
  158.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement