c++ problem
Dear friends is any one of you explain me about nested loops in c++ with examples
also please tell me about a c++ program which displays a pyramid made of *(sterics)
also please tell me about a c++ program which displays a pyramid made of *(sterics)
Replies
-
Varsha0802Nested loops are loops which run inside other loops.
Program for displaying a pyramid:
#include
int main()
{ int i,j,k;
for(i=1;i<=5;i++)
{ for(k=5;k>=i;k--)
printf(" ");
for(j=2;j<=2*i;j=j+1)
{ printf("*");
}
printf("\n");
}
return(0);
}
Here, two loops are running inside a for loop. Therefore, the loops are nested. -
PraveenKumar Purushothaman@Varsha, it would be better to write the coding inside the code tags...
#include
int main() { int i,j,k; for(i=1;i<=5;i++) { for(k=5;k>=i;k--) printf(" "); for(j=2;j<=2*i;j=j+1) printf("*"); printf("\n"); } return(0); } -
Varsha0802
Ok i'll keep it in mind from the next time. Thanks for pointing in out.praveenscience@Varsha, it would be better to write the coding inside the code tags...
#include
int main() { int i,j,k; for(i=1;i<=5;i++) { for(k=5;k>=i;k--) printf(" "); for(j=2;j<=2*i;j=j+1) printf("*"); printf("\n"); } return(0); }
You are reading an archived discussion.
Related Posts
Statics, Dynamics and Strength of Materials
From: The College of Engineering and Technology, University of Neraska, Lincoln
Engineering Mechanics
Bioramani
It’s a discussion about the LG’s 3d glasses without batteries:
Recently LG has introduced its battery-free 3d glasses in India, I want to know that how these glasses will work...
winner is ishuttopre from bharat
although ishutopre is not able to send its drawing but i hope that he really done the relative task so i suggest you to appreciate...
S.K.P. Engineering College, Tiruvannamalai, India, is organizing an International Conference, [FONT="]ICDAAME-2011[/FONT], on “Design and Advances in Mechanical Engineering".
ICDAAME-2011 is intended for engineers, researchers and technologists, interested in the fundamentals,...
CEans, I have a crazy doubt
What will happen if the supply is given directly to the permanent magnet?