Advertisement
dllbridge

Untitled

Sep 28th, 2023
941
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.12 KB | None | 0 0
  1.  
  2.  
  3. #include    <stdio.h>
  4.  
  5.  
  6. int nStartPrice = 1000,
  7.     nDelta      =   55;
  8.  
  9.  
  10. int Serial (int n);
  11. int Ostatok(int n);
  12.      
  13.    
  14. ////////////////////////////////////////////////////////
  15. int main()                                            //
  16. {
  17.    
  18.     int nX;// = Serial(2);
  19.    
  20.    
  21.    
  22.    
  23.    
  24.  
  25.     scanf("%d", &nX);  // 8
  26.    
  27.     int nS = nX/7,
  28.         nO = nX%7;
  29.    
  30.    
  31.     nO = Ostatok(nO);
  32.     nS =  Serial(nS);
  33.  
  34.     nX = nO + nS;
  35.  
  36.     printf("Summa = %d\n", nX);
  37.    
  38. }  
  39.  
  40.      
  41. ////////////////////////////////////////////////////////    
  42. int Ostatok(int n) // <= 7!
  43. {
  44.    
  45.     int nSumma =    0,
  46.         nSP    = 1000;//nStartPrice;  
  47.    
  48.  
  49.     for(int i = 0; i < n; i ++)
  50.     {
  51.         nSumma = nSumma + nSP;
  52.        
  53.  
  54.         nSP -= 55;  //  nSP  = nSP - 55;
  55.     }  
  56.    
  57. return nSumma;   
  58. }
  59.      
  60.          
  61.      
  62.      
  63.      
  64. ////////////////////////////////////////////////////////    
  65. int Serial(int n)
  66. {
  67.    
  68.     int nSumma =    0,
  69.         nSP    = 1000;//nStartPrice;  
  70.    
  71.  
  72.     for(int i = 0; i < 7; i ++)
  73.     {
  74.         nSumma = nSumma + nSP;
  75.        
  76.  
  77.         nSP -= 55;  //  nSP  = nSP - 55;
  78.     }  
  79.    
  80. return nSumma * n;   
  81. }
  82.      
  83.      
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement