Advertisement
dllbridge

Untitled

Aug 15th, 2024
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.49 KB | None | 0 0
  1.  
  2. #include       <stdio.h>
  3. #include      <stdlib.h>
  4.  
  5. int n = 8;
  6.  
  7.  
  8. int foo(int *);
  9.  
  10. ////////////////////////////////////////////////////
  11. int main()                                      
  12. {
  13.    
  14.     int n = 123;
  15.    
  16.     int *p = (int*)malloc(sizeof(int)*10);
  17.    
  18.        
  19.     for(int i = 0; i < 10; i++)
  20.     {
  21.        
  22.         p[i] = 100 + i;
  23.     }
  24.    
  25.    
  26.        
  27.     for(int i = 0; i < 10; i++)
  28.     {
  29.        
  30.         printf("%d\n", p[i]);
  31.     }    
  32. }
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66. /*
  67.  
  68. #include       <stdio.h>
  69.  
  70.  
  71.   int   n  =  8;
  72.  
  73. __int32 n2 = 71;
  74.  
  75. __int16 n3 = 211;
  76.  
  77. unsigned __int8  n4 = 211;
  78.  
  79. ////////////////////////////////////////////////////
  80. int main()                                      
  81. {
  82.  
  83.  
  84.     printf("size of n  = %d bytes.\n", sizeof(n ));
  85.     printf("size of n2 = %d bytes.\n", sizeof(n2));  
  86.     printf("size of n3 = %d bytes.\n", sizeof(n3));    
  87.     printf("size of n4 = %d bytes.\n", sizeof(n4));    
  88.    
  89.    
  90.     for(int i = 240; i < 260; i++)
  91.     {
  92.        
  93.         n4 = i;
  94.        
  95.         printf("n4 = %d\n", n4);
  96.     }
  97. }
  98.  
  99.  
  100.  
  101. */
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120. /*
  121.  
  122. #include       <stdio.h>
  123. #include      <stdlib.h>
  124.  
  125. int n = 8;
  126.  
  127.  
  128. int foo(int *);
  129.  
  130. ////////////////////////////////////////////////////
  131. int main()                                      
  132. {
  133.    
  134.     int n = 123;
  135.    
  136.     int *p = (int*)malloc(4);
  137.    
  138. }
  139.  
  140.  
  141.  
  142. ///////////////////////////////////////////////////
  143. int foo(int *p)
  144. {
  145.    
  146.    
  147.    
  148. }
  149.  
  150.  
  151. */
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166. /*
  167.  
  168.  
  169. #include       <stdio.h>
  170.  
  171.  
  172. float fn = 17;
  173.  
  174. float f = 2.99;
  175.  
  176. ////////////////////////////////////////////////////
  177. int main()                                      
  178. {
  179.    
  180.     fn += f;
  181.    
  182.     printf("fn = %.2f\n", fn);
  183. }
  184.  
  185.  
  186.  
  187.  
  188. */
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207. /*
  208. #include       <stdio.h>
  209.  
  210.  
  211. int n = 17;
  212.  
  213.  
  214.  
  215. ////////////////////////////////////////////////////
  216. int main()                                      
  217. {
  218.    
  219.     float f = (float)n/2;
  220.    
  221.     printf("n2 = %.2f\n", f);
  222.    
  223. }
  224.  
  225. */
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250. /*
  251. #include       <stdio.h>
  252.  
  253.  
  254. int n = 17;
  255.  
  256.  
  257.  
  258. ////////////////////////////////////////////////////
  259. int main()                                      
  260. {
  261.    
  262.     int n2 = n/2;
  263.    
  264.     printf("n2 = %d\n", n2);
  265.    
  266. }
  267.  
  268.  
  269. */
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300. /*
  301. #include       <stdio.h>
  302. #include      <stdlib.h>
  303.  
  304. int n = 8;
  305.  
  306.  
  307. int foo(int *psdgjhskjdgh);
  308.  
  309. ////////////////////////////////////////////////////
  310. int main()                                      
  311. {
  312.    
  313.     int n = 123;
  314.    
  315.     int *p = (int*)malloc(4);
  316.    
  317. }
  318.  
  319.  
  320.  
  321.  
  322. int foo(int *p)
  323. {
  324.    
  325.    
  326.    
  327. }
  328.  
  329.  
  330.  
  331.  
  332. */
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358. /*
  359.  
  360. #include       <stdio.h>
  361.  
  362.  
  363. int nNumb = 2;                                    //                                    kolichestvo knig
  364.  
  365. ////////////////////////////////////////////////////
  366. int reset(int *p1, int *p2)                       //
  367. {
  368.        
  369.      if( *p1 >    6)  {
  370.          *p1 =    0;
  371.          *p2 = 1000;
  372.      }
  373. }
  374.  
  375.  
  376. ////////////////////////////////////////////////////
  377. int main()                                      
  378. {
  379.    
  380.    int     t =    0,
  381.            n = 1000,
  382.      counter =    0;
  383.        
  384.     for(int i = 0; i < nNumb; i++)
  385.     {  
  386.         t = t+n;
  387.         n = n-55;
  388.         counter = counter + 1;    
  389.        
  390.         reset( &counter, &n);
  391.     }
  392.        
  393.     printf("Total cost %d = %d\n", nNumb, t);
  394. }
  395.  
  396.  
  397. */
  398.  
  399.  
  400.  
  401.  
  402.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement