how can i make a program which using a for loop statement and has an output of like pyramid using with asteris
94728
well, you didn't specify a language so here's korn shell:\n\n#! /bin/ksh\nread c\nTEMP=1\nwhile [ $TEMP -lt $c ]; do\n  echo "**********************************" | cut -c1-$TEMP\n  let "c += 1"\ndone\n\nmy c++ is a bit rusty, but the loop would look like this:\n\nwhile ( c = 1; c <= count ; c++ )\n{\n  while ( d = 1; d <= c; d++ )\n  {\n    cout << "*";\n  }\n  cout << endl;\n}\n\nhope this helps :-)
75512
hey champ(Anirudh) !! what happened... so many errors in ur code?\ni hv'nt done much.. just removed the errors.. \nwell ur code was just like an error removing question... that v used to solve in the boards!  i loved solving those easy pickings!!\n\nanyways.. heres the exact code.. \n\n\n#include<iostream.h>\n#include<conio.h>  //for clrscr() & getch()\n\nvoid main()\n{\nclrscr();         //optional\nint array[10],i,least,greatest;\n\n//Input Numbers\ncout<<" Input 10 numbers separated by spaces  : &#92;n";\nfor(i=0;i<10;++i)\n   {\ncin>>array[i];\n   }\n\ngreatest=least=array[0];\n\nfor(i=1;i<10;++i)\n   {\nif(array[i]>greatest)\n     greatest=array[i];\nif(array[i]<least)\n   least=array[i];\n   }\ncout<<"&#92;nLeast in the list is "<<least;\ncout<<"&#92;nGreatest in the list is "<<greatest;\ngetch();//optional\n}
457195
the simple program given above if fine.. in terms of the conncept.. but there's a bug... \nthe problem is with looping.. coz when u enter a number such as 80301  or 55302 ( a no. having 0 in between), the loop breaks at the point when zero is encountered.\n\n so the output in the first eg. is  8 0 ,sum= 8 (instead of correct 8 0 3 0 1 , sum=12\n\n\nso the logic of handling the number is absolutely correct but the looping is a comparatively difficult job in this case!
877964
here is part of solution. the rest figure it out yourself :-).\n\n int nLines = 5;\n \n     for (int i = 1; i <= nLines; i++)\n     { \n \nint nSpaces = i - 1;\n \n         int nAsterisks = 2 * (nLines - i) + 1;\nfor (int j = 1; j <= nSpaces; j++)\n \n    System.out.print(" ");\n \nfor (int j = 1; j <= nAsterisks; j++)\n \n System.out.print("*");\n \nSystem.out.println("");\n }
993077
not that I know...you might have to wright your own algorithm!\n\nouch...have fun!\n\nbut check links!!
446119
look at resource below: (code in Python language)\n\n(By the way is it your school assignment? you have asked this question in many categories!!!, so if it is your assignment, i hope this will not be in Python, but try to grasp on the algorithm not on the code: if u know the algo better, u can easily convert into code with little effort)
195373
Try this:\n\n#include <stdio.h>\n\nmain()\n{\nint size,array[50],n,m,border,max,buf,step;\nint i, j, temp;\n\nprintf("Input number of elements in array:");\nscanf("%d",&size);\n\nfor(n=0;n<size;n++) {\n  printf("input %d. element of array:",n+1);\n  scanf("%d",&array[n]);\n  }\n\n for (i=(size-1);i>=0; i--)\n  {\n   for(j=1;j<=i;j++)\n    {\n     if(array[j-1]>array[j])\n      {\n       temp=array[j-1];\n       array[j-1]=array[j];\n       array[j]=temp;\n      }\n     }\n   }\n\nfor(n=0;n<size;n++)\n   printf("%d. element: %d&#92;n",n+1,array[n]);\n\n}\n\n\n\nHERE IS MY OUTPUT:\n\nInput number of elements in array:8\ninput 1. element of array:6\ninput 2. element of array:2\ninput 3. element of array:3\ninput 4. element of array:5\ninput 5. element of array:1\ninput 6. element of array:4\ninput 7. element of array:5\ninput 8. element of array:7\n1. element: 1\n2. element: 2\n3. element: 3\n4. element: 4\n5. element: 5\n6. element: 5\n7. element: 6\n8. element: 7
34052
I do not know a preprogrammed utility to do this, but can point you in the direction that you might need to go.  See the reference below for the math and an on-line converter:
769912
you loop after I if loop needs to have a concat for  -0-1-2-3-4-5-6- which you never made, you only made one for the Y columns\ni'm don't have java install so i can't check it for sorry.
709055
Look at your second loop (while (LineNumber > 0))...\n\nYou're drawing the symbols and *then* you're drawing the spaces.\n\nReverse the order you do those two things.  Draw the spaces first. :)
253461
®\nuse ascii:\n\n\n<p>& # 1 7 4 ;</p>\nwithout the spaces
674650
http://pearpc.sourceforge.net/doc.html
995086
Good Luck\n\nhttp://aresgalaxy.sourceforge.net/
457596
Surface area:\nCylinder(lateral):2 times pie times radius times height\ncylinder(total): 2 times pie times radiuse times height + 2 times pie radius squared\nTriangular prism(total): find the area of every side and add all together to get surface area(hint:area of a triangle=1/2bh or bh/2)\nCone(lateral):pie times radius times length\nCone(total):pie times radius times length + pie squared\npyramid(total):find area of ever side and add all together \narea of a triangle=1/2bh bottom of the pyramid is length times width
253284
#include <stdio.h>\n\nint main(void) {\n\nint i, j, count; //C Sucks, wait till you take java\n\nfor(i=1; i<=1000; i++){&#92;&#92;goes through all numbers 1 to 1000\n    count=0;\n    for(j=2; j<i; j++)&#92;&#92;goes through all numbers 2 to i\n    {\n     if(i%j==0)&#92;&#92;checks to see if it i is evenly div. by i\n        count++;\n    }//nested for\n    if (count ==0)\n        printf("%d&#92;n", i);\n}//for\n\nreturn 0;\n}//main\n\n\n//Hope that helps!
350177
Sometimes adding some indents will help figure out what's going on.  In your algorithm, you have a lot of nested if and while statements, so space them out like this first to see how each is related to each other (I'm using periods because Yahoo won't show spaces):\n\ni <- 0\nwhile (i < n) do\n...j <- i+1\n...m <- a[i]\n...while (j < n) do\n......if (m > a[j]) then\n.........m <- a[j]\n......end if\n......j <- j + 1\n...end while\n...b[i] <- m\n...i <- i + 1\nend while\n\nYour i is a counter that starts with 0, and your j is a counter that starts with 1.  j will always be more than i.\n\nThe "while (i < n) do" line limits this algorithm to 3 loops, since n is 3.\n\nDirectly after this statement, j is established as a counter, and m is defined to be the i-th element of your matrix.  The next while statement then compares m (the i-th element in the matrix) to the element after this (using j to read the next element).\n\nIf m is larger, then the if statement makes m take on the smaller value.  If m is smaller, nothing happens and j is indexed to the next value.  Then the process repeats itself.  If we get to the end of the matrix and m isn't replaced anymore, it becomes the i-th value in matrix B.  After this, i is indexed to the next element in matrix A and the entire process is repeated once again, until all of matrix A has been checked.\n\nThe result then is that through m, matrix A is sorted least to greatest and is written into matrix B, which is answer (d).
816710
Create an outer for loop that will loop from 7 down to 0, with a step of 2.\n\nCreate one inner loops.\n\nThe inner loop should take the value of i, place it in another variable and count down to 0.\nThen print out the dollar signs for each iteration of this loop.