Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  1. import java.util.*;
  2. class IFf(String[] args)
  3. {
  4. int a;
  5. int b;
  6. System.out.println("найти сумму A + B");
  7. public void setA(Integer _a) {
  8. a = _a;
  9. }
  10. public void setB(Integer _b) {
  11. b = _b;
  12. }
  13. void vvod1(int a,int b)
  14. {
  15. Scanner in = new Scanner(System.in);
  16. System.out.println("Enter a: ");
  17. int a = in.nextInt();
  18. System.out.println("Your input is: " + a);
  19.  
  20. Scanner in = new Scanner(System.in);
  21. System.out.println("Enter b: ");
  22. int b = in.nextInt();
  23. System.out.println("Your input is: " + b);
  24. }
  25. void printAplusB(int a, int b)
  26. {
  27. if (a>b)
  28. {
  29. System.out.println("summa A + B"+ (a + b));
  30. }
  31. }
  32. public static void main( String[] args )
  33. {
  34. IFf c= new IFf();
  35. c.setA(59);
  36. c.setB(50);
  37. }
  38. }
  39. class Wwhile(String[] args)
  40. {
  41. System.out.println("возвести с в квадрат");
  42.  
  43. int c;
  44. void vvod2(int c)
  45. {
  46. Scanner in=new Scanner(System.in);
  47. System.out.println("Enter c: ");
  48. int c=in.nextInt();
  49. System.out.println("Your input is: "+c);
  50. }
  51. public void setC(Integer _c)
  52. {
  53. c=_c;
  54. }
  55. void cvkvadrate(int c)
  56. {
  57. while(c>=0)
  58. {
  59. System.out.println("c v kvadrate'="+c*c);
  60. }
  61. }
  62. public static void main(String[]args)
  63. {
  64. Wwhile d =new Wwhile();
  65. d.setC(5);
  66. }
  67. }
  68.  
  69. class Ddowhile(String[] args)
  70. {
  71. System.out.println("увеличить d на 1");
  72. int d;
  73. void vvod3(int d)
  74. {
  75. Scanner in=new Scanner(System.in);
  76. System.out.println("Enter d: ");
  77. int d=in.nextInt();
  78. System.out.println("Your input is: "+d);
  79. }
  80. public void setD(Integer _d)
  81. {
  82. d=_d;
  83. }
  84. void yvelicnnaodin()
  85. {
  86. int d;
  87. do
  88. {
  89. System.out.println(i);
  90. d++;
  91. }
  92. while(d<10);
  93. }
  94. public static void main(String[]args)
  95. {
  96. Ddowhile c =new Ddowhile();
  97. c.setD(4);
  98. }
  99. }
  100.  
  101.  
  102. class ffreach(String[] args)
  103. { System.out.print("Найти сумму элементов массива")
  104. void vvod4(int array[])
  105. {
  106. Scanner input = new Scanner(System.in);
  107. System.out.println("Enter array length: ");
  108. int size = input.nextInt();
  109. int array[] = new int[size];
  110. System.out.println("vvedite array elements:");
  111. for (int i = 0; i < size; i++) {
  112. array[i] = input.nextInt();
  113. }
  114. System.out.print (vivod array elements:");
  115. for (int i = 0; i < size; i++) {
  116. System.out.print (" " + array[i]);
  117. }
  118. System.out.println();
  119. }
  120. void summaelementov()
  121. {
  122. int sum=0,i=0;
  123. for(int x:nums)
  124. {
  125. println("Znachenie num [" + (i++) + "ravno:" + x);
  126. sum += x;
  127. }
  128. println("Summa ravna"+sum);
  129. }
  130. }
  131. class Sswitch(String[] args)
  132. {
  133. void vvod5
  134. {
  135. Scanner in=new Scanner(System.in);
  136. System.out.println("Enter s: ");
  137. int s=in.nextInt();
  138. System.out.println("Your input is: "+s);
  139. }
  140.  
  141. void vibor
  142. {
  143. int s;
  144. switch(s)
  145. {
  146. case 1:
  147. System.out.println("0");
  148. break;
  149. case 2:
  150. System.out.println("1");
  151. break;
  152. case 3:
  153. System.out.println("2");
  154. break;
  155. }
  156. }
  157. public static void main(String[]args)
  158. {
  159. Sswitch c =new Sswitch();
  160. c.setS(4);
  161. }
  162. }
  163. class Ffor(String[] args) {
  164.  
  165. void vvod6()
  166. {
  167. Scanner in = new Scanner(System.in);
  168. System.out.println("Enter h: ");
  169. int h = in.nextInt();
  170. System.out.println("Your input is: " + h);
  171. }
  172. void ff()
  173. {}
  174. System.out.println("Vvedite h: ");
  175. for (int d = h; d < 10; d++) {
  176. System.out.println("\d: " + d);
  177. }
  178. }
  179. public static class main (String[] args) {
  180. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement