Which one of the following is a fundamental difference between WHILE Loops and numeric FOR Loops?
460316
3.\n\nThe others are just all wrong...
440005
Pseudocode, I'm not up on my Java syntax:\n\nint sum=0;\nfor(int i=0;i<array.size;i++)\n  sum+=array[i];
959017
I see two issues, in addition to the division problem pointed out above.  First, you should initialize your variables.  In particular, set sum=0 at the beginning of your code. Do the same for counter.\n\nNext, you have logic issues.  For min and max, you have to initialize these variables, but just setting them to 0 may not work.  If the user enters a series of negative values, you may falsely report 0 as a max. So, the classic solution is to initialize min and max to the first number given by the user.  Of course, this means you'll have to prompt the user for input outside the loop.\n\nBut actually, this helps to solve the other problem.  In particular, when the user enters 0, you still increment your counter. It would be best to redesign your code a little so that the loop condition guarantees that the most recent user value is not zero. You can do this by changing the type of loop that you use, and by asking for the first value outside the loop. \n\nI haven't quite given you all the details, but that's because I want you to think about it yourself.  It'll be a valuable exercise.
875702
can't you just loop through the array, have a variable for smallest number and one for position. \n\nthen in the loop, if current array value < than variable set the variable = to the current array value and set the variable pos = pos in the array\n\nthat way, when the loop ends, your two variables will hold the smallest value and the position in the array of that value,\n\nhope that's what you're after\n\ngood luck  :¬)
708472
They save duplicating code. That also means that once you get the loop code correct you don't have to test other duplicated copies of it for errors. \n\nIt also makes it easier to structure the program because the details of the loop processing are in one place.\n\nThey shorten the program so that it is easier to scan when bench checking.
860421
you need to filter on the bound column, which is the first column, which is numeric.  \n\nAnnual=4\n\nFilter in 4\n\nhope this helps..
912485
there is no "code" for it. The compiler evaluates it at the compile time, and replaces with the actual number.\nThere is no way to write a function that would did that at run time, because at run time, there is not type information available - only addresses of variables not their sizes
770189
Number will have to be the actual number it is working it out from..and it might not work as a long and definately not an integer.\n\nNumber as String\nOdd as Long (or Integer)\nEven as Long ( or Integer)\n\nIf Not (Number <1 or Number > 10) Then\nNumber = Number / 2\nIf InStr(Number, ".5") then\nOdd = Odd + 1\nElse\nEven = Even + 1\nEnd If\nEnd If\nMe.Print "Odd: " & Odd & " - " & "Even: " & Even
374602
yup.. started out with BASIC.. loong back. Am surprised someone has actually asked a question in this prehistoric language!!\n\nThis language is the best example for SPAGHETTI CODE  ... lotsa goto statements to be used for loops, if conditions etc..slightly better than assembly..that's it!! \n\n\n\n\nHere is an example .. and there is a for loop and an if condition here..\n\n 10 INPUT "What is your name: "; U$\n 20 PRINT "Hello "; U$\n 30 REM\n 40 INPUT "How many stars do you want: "; N\n 50 S$ = ""\n 60 FOR I = 1 TO N\n 70 S$ = S$ + "*"\n 80 NEXT I\n 90 PRINT S$\n 100 REM\n 110 INPUT "Do you want more stars? "; A$\n 120 IF LEN(A$) = 0 THEN GOTO 110\n 130 A$ = LEFT$(A$, 1)\n 140 IF (A$ = "Y") OR (A$ = "y") THEN GOTO 40\n 150 PRINT "Goodbye ";\n 160 FOR I = 1 TO 200\n 170 PRINT U$; " ";\n 180 NEXT I\n 190 PRINT\n\n\nDo u seriously wanna continue studying this horrible language?? I would recommend C .. rather some prehistoric piece of junk.
1078011
Conditional statements only include those using if, if else, if else if, and switch, so while, do while, and for loops should be acceptable.  The answer is then either:\n\nint x = 1;\ndo{\n  printf(“&#92;n”, x);\n  x++;\n}while (x < 100);\ndo{\n  printf(“&#92;n”, x);\n  x--;\n}while (x > 0);\n\nOR:\nfor (int x = 1; x < 100; x++){\n  printf(“&#92;n”, x);\n}\nfor (x = 100; x < 0; x--){\n  printf(“&#92;n”, x);\n}
348563
for ($i=10; $i >= 0; $i--) {\n  print "$i ";\n}
762091
they are similar because they have '435' , they are lower than 1\nthey are dfferent from each other because : -453 is an negative integer , 0.453 is a positive real number
226919
You are correct in how the programming is running.  However the '9' IS NOT garbage data.  The PrintF function does return the total number of characters printed if you are looking for it.  it does it internal to the printf function so you don't need a return on your sub routine.\n\nhttp://www.cplusplus.com/ref/cstdio/printf.html
968405
Saves you having to type the same code a hundred times to get the same tasks done a hundred times in succession.\n\nA loop lets you use the same code over and over again. Very beneficial.\n\n///
129073
The code below will work.\n\nint main()\n{\nint aNum,i;\ncout<<"enter a number";\ncin>> aNum;\nfor(i=0;i<aNum;i++)\n{\nfor(j=0;j<=i;j++)//nested loop\ncout<<"*";// end of nested loop\ncout<<'&#92;n';\n}// end of outer loop\nreturn 0;\n}
457026
Create a method called numDigits(long). Then you can use code something like this:\n\nint num;\ncin >> num;\n\nint numDigs = numDigits( num );\nint digits[ numDigs ];\nint temp = num;\nfor ( int i = numDigs - 1; i >= 0; i-- )\n{\n digits[ i ] = temp % 10;\n temp = (int)( temp / 10 );\n}\n\nThe digits array holds each of the digits in the number.\nThis is the code I used for numDigits():\n\nint numDigits( long num )\n{\nint digits;\nfor ( digits = 0; num > 0; digits++ )\n{\nnum /= 10;\n}\n\nreturn digits;\n}
158397
C solution:\n\nint nr[20];\nint valid=1,i,j;\nint main(int argc, char **argv){\nfor (i=0;(i<20)&&(valid);i++){\n scanf("%d",&nr[i]);\n if (nr[i]<10)||(nr[i]>100){\n  printf("Invalid number");\n  valid=0;\n }\n for (j=0;j<i;j++)\n  if (nr[j]==nr[i]){\n    printf("Duplicate number");\n    valid=0;\n  }\n}\n}