Advertisement
dllbridge

Untitled

Nov 3rd, 2024
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 KB | None | 0 0
  1.  
  2. #include   <stdio.h>
  3.  
  4. int foo(int);
  5.  
  6.  
  7. ///////////////////////////////////////////////////////////////
  8. int main()
  9. {
  10.     int n        =  21,
  11.         nSerial  = n/7,
  12.         nOstatoc = n%7,  
  13.         nSumma   =   0;    
  14.    
  15.     nSumma = nSerial * foo(7);
  16.    
  17.     nSumma += foo(nOstatoc);
  18.  
  19.     printf("nSumma = %d \n", nSumma);
  20. }
  21.  
  22. /////////////////////////////////////////////////////////////////
  23. int foo(int nOstatoc)
  24. {
  25.    
  26.     int nSumma =    0,
  27.         nPrice = 1000;
  28.    
  29.     for(int i = 0; i < nOstatoc; i++)
  30.     {
  31.         nSumma += nPrice;  
  32.         nPrice -=     55;
  33.     }    
  34.    
  35. return nSumma;
  36. }
  37.  
  38.  
  39.  
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement