• Register

Recent questions tagged loops

0 votes
1 answer 16 views
Problem: I am confused about the do-while loop. My question is simple. In a do-while loop, which block executes first? Why? Does the while always execute?
asked Jan 17 Code Learner 5.5k points
0 votes
1 answer 9 views
Problem: My programming teacher gave us an assignment in which we have to tell which of the three loops in C++ does not have an entry condition? As far as my guess is concerned, the 'for' loop does not need an entry condition. I want you to guide me if I am wrong and tell me the correct answer to this question. Thanks!
asked Dec 17, 2020 Code Learner 5.5k points
0 votes
1 answer 5 views
Problem: Hello! I have got an exercise in which I have to arrange four integers in ascending order, and I can use only loops and conditional statements. I do not know how I can do this as I do not have a lot of hands-on experience. If someone could provide me with the sample program, I would be very thankful.
asked Nov 30, 2020 Code Learner 5.5k points
0 votes
1 answer 25 views
Problem: I just started Bachelors in Software Engineering. Programming is the main subject of Software Engineering and I have no prior knowledge of programming. My programming teacher gave me an assignment in which I have to write a program in C++ whose output should be as ... a hint: Use nested loop. If someone knows how to do this kindly explain and provide me with the example program. Thanks.
asked Nov 29, 2020 Code Learner 5.5k points
0 votes
1 answer 20 views
Problem: Hello Programmers, I am a noob and just came to know about the loop constructs in C#. I tried running while and do-while loops in a program and got different output. Following are the programs that I executed: //Program 1 int a = 0; do { Console.WriteLine( ... ; } Console.ReadKey(); The output has confused me and I want to know the major difference in the while and do-while loops. Thanks!
asked Nov 28, 2020 Code Learner 5.5k points
0 votes
1 answer 11 views
How do I delete ï »from the beginning of a file? I have a CSS file that looks fine when I open it using gedit, but when read by PHP (to combine all CSS files into one), this CSS has the following prepended characters: ï &raquo ... more characters that cannot be encoded using the specified character encoding). Tried saving it with Windows and Linux line endings, but neither helped.
asked Aug 22, 2020 sasha 6.4k points
0 votes
1 answer 11 views
In the first loop that runs with ++ of the function it returns 29 and the second that runs with + i returns 30, but both should return 29. What am I doing? #include <iostream> using namespace std; int sumElements (int a [], int size) {      int accum = 0;      int * p;      p = & a [0]; ...      } int main () {      int array [5] = {4,9,6,7,3};      cout << sumElements (array, 5);      return 0; }
asked Aug 14, 2020 game 4.6k points
1 vote
2 answers 141 views
Problem : I am very new to Programming. I have recently started learning C Programming. I have written below code but I am facing following error. Please find below my source code for your reference: #include <stdio.h> void myfirstfunct(int[6]); int main() {        ... use option -std=c99 or -std=gnu99 to compile your code` I am looking for the very expert advice on quickly fixing above error.
asked Apr 16, 2020 morrisBson 3.2k points
1 vote
2 answers 158 views
Problem : I am very new to programming world. According to my senior a for loop will always get executed at least once even if a required condition is not met. Please find below example for your reference: for (int i=6; i <=5; i++) {     //inappropriate for this ... } According to my senior above listed loop will be executed at least once but it does not or let me know if I am I missing something?
asked Apr 6, 2020 morrisBson 3.2k points
0 votes
1 answer 153 views
Problem : Looking for solution of following doubt if one for loop is nested within another, then the counter variables for the two loops should be
asked Nov 12, 2019 peterlaw 6.9k points
To see more, click for the full list of questions or popular tags.