0

basic algorithms on loops

I am really struggling with the summing, counting, Searching for an objects , maximum, minimum , arrays, abstract classes and interfaces in Java

5th Apr 2018, 9:18 AM
Tozo Tozo
Tozo Tozo - avatar
6 odpowiedzi
+ 1
Your question covers too many areas. It would be better to ask each of these as a single question. Maybe ask one question a day, and spend each day understanding answers you receive.
5th Apr 2018, 9:27 AM
Emma
0
for (int i = 1; i <=5; i++) The first group is initialization of loop pointer. It runs only once on loop start. The second group is condition when loop should continue do something, if condition is true then it works. The last group is changing our pointer (just adding 1 to it) - it happens at the end of each repetition of loop. for (int i = 1; i <= 5; i++) System.out.println(i); Output: 1 2 3 4 5
5th Apr 2018, 9:26 AM
Bartosz Pieszko
Bartosz Pieszko - avatar
0
when we write tests, all the areas I have mentioned are included, so i am only good at UML diagrams and i identifying classes from problem statements
5th Apr 2018, 7:16 PM
Tozo Tozo
Tozo Tozo - avatar
0
Thanx Bartosz Pieszko , can you please include arrays in your loops, like searching for an element in an array using a for loop
5th Apr 2018, 7:20 PM
Tozo Tozo
Tozo Tozo - avatar
0
Tozo Tozo int element = 5, t[100]; for (int i=0; i<100; i++) t[i] = 100-i; for (int i=0; i<100; i++) if (t[i] == element) cout << "Found element at index " << i << endl;
6th Apr 2018, 12:46 PM
Bartosz Pieszko
Bartosz Pieszko - avatar
0
thank you very much Bartosz Pieszko
6th Apr 2018, 5:20 PM
Tozo Tozo
Tozo Tozo - avatar