SaveText.Ru

Си
  1. // Hello, world!
  2. //
  3. //#define _CRT_SECURE_NO_WARNINGS
  4. //#include <stdio.h>
  5. //
  6. //int main()
  7. //{
  8. //    char a[10];
  9. //    printf("What's your name?n");
  10. //    scanf("%s", a);
  11. //    printf("Hello, %s!n", a);
  12. //      return 0;
  13. //}
  14.  
  15.  
  16. // Get a and b, calculate area and perimeter of rectangle
  17.  
  18. //#define _CRT_SECURE_NO_WARNINGS
  19. //#include <stdio.h>
  20. //
  21. //int main()
  22. //{
  23. //      double a, b;
  24. //      printf("Enter two sides of rectanglen");
  25. //      scanf("%lf%lf", &a, &b);
  26. //      printf("Perimeter of rectangle is %.2lfn", 2 * (a + b));
  27. //      printf("Area of rectangle is %.2lfn", a * b);
  28. //      return 0;
  29. //}
  30.  
  31.  
  32. // Get radius and calculate length and area of circle
  33.  
  34. //#define _CRT_SECURE_NO_WARNINGS
  35. //#include <stdio.h>
  36. //#define _USE_MATH_DEFINES
  37. //#include <math.h>
  38. //
  39. //int main()
  40. //{
  41. //      int radius;
  42. //      printf("Enter radiusn");
  43. //      scanf("%d", &radius);
  44. //      printf("Circumference is %.2lfn", 2 * M_PI * radius);
  45. //      printf("The area of circle is %.2lfn", M_PI * pow(radius, 2));
  46. //      return 0;
  47. //}
  48.  
  49. // Get 3 integers and calculate perimeter and area of triangle
  50.  
  51. //#define _CRT_SECURE_NO_WARNINGS
  52. //#include <stdio.h>
  53. //#include <math.h>
  54. //
  55. //int main()
  56. //{
  57. //      int a, b, c;
  58. //      double p;
  59. //      printf("Enter 3 sides of trianglen");
  60. //      scanf("%d%d%d", &a, &b, &c);
  61. //      if (a + b > c && a + c > b && b + c > a)
  62. //      {
  63. //              p = (a + b + c) / 2.0;
  64. //              printf("Perimeter of triangle is %.2lfn", p * 2);
  65. //              printf("Area of triangle is %.2lfn", sqrt(p * (p - a) * (p - b) * (p - c)));
  66. //      }
  67. //      else
  68. //      {
  69. //              printf("It's not a tringlen");
  70. //      }
  71. //      return 0;
  72. //}
  73.  
  74. //#define _CRT_SECURE_NO_WARNINGS
  75. //#include <stdio.h>
  76. //#include <math.h>
  77. //
  78. //int main()
  79. //{
  80. //      int a, b, c;
  81. //      double p;
  82. //      do
  83. //      {
  84. //              printf("Enter 3 sides of trianglen");
  85. //              scanf("%d%d%d", &a, &b, &c);
  86. //      } while (!(a + b > c && a + c > b && b + c > a));
  87. //
  88. //      p = (a + b + c) / 2.0;
  89. //      printf("Perimeter of triangle is %.2lfn", p * 2);
  90. //      printf("Area of triangle is %.2lfn", sqrt(p * (p - a) * (p - b) * (p - c)));
  91. //      return 0;
  92. //}
  93.  
  94. //#define _CRT_SECURE_NO_WARNINGS
  95. //#include <stdio.h>
  96. //#include <math.h>
  97. //
  98. //int main()
  99. //{
  100. //      int a, b, c;
  101. //      double p;
  102. //      printf("Enter 3 sides of trianglen");
  103. //      scanf("%d%d%d", &a, &b, &c);
  104. //      while (!(a + b > c && a + c > b && b + c > a))
  105. //      {
  106. //              printf("It's not a tringlenTry again, pleasen");
  107. //              scanf("%d%d%d", &a, &b, &c);
  108. //      }
  109. //      p = (a + b + c) / 2.0;
  110. //      printf("Perimeter of triangle is %.2lfn", p * 2);
  111. //      printf("Area of triangle is %.2lfn", sqrt(p * (p - a) * (p - b) * (p - c)));
  112. //      return 0;
  113. //}
  114.  
  115. // Calculate pow's of 2
  116. //#define _CRT_SECURE_NO_WARNINGS
  117. //#include <stdio.h>
  118. //
  119. //int main()
  120. //{
  121. //      unsigned int step = 0;
  122. //      unsigned long long res = 1;
  123. //      printf("Enter powern");
  124. //      scanf("%d", &step);
  125. //      for (int i = 0; i <= step; ++i)  //++i == i++  ++i ==> i = i+1
  126. //      {
  127. //              printf("2^%2d = %15lldn", i, res);
  128. //              res *= 2; //res = res*2;
  129. //      }
  130. //      return 0;
  131. //}
  132.  
  133.  
  134. // Calculate functions
  135. //#define _CRT_SECURE_NO_WARNINGS
  136. //#include <stdio.h>
  137. //
  138. //int main()
  139. //{
  140. //    double start = -1, finish = 1, step = 0.01;
  141. //    printf("Enter start and finish and stepn");
  142. //    scanf("%lf%lf%lf", &start, &finish, &step);
  143. //    printf("x^2+2*x+4n");
  144. //    for (double i = start; i <= (finish + step/2); i+=step)  //++i == i++  ++i ==> i = i+1
  145. //    {
  146. //        printf("x = %.2lf y = %.2lfn", i, i*i+2*i+4);
  147. //    }
  148. //    return 0;
  149. //}

Share with your friends:

Print