9 Mar 2013

Pattern_nested LOOP

/*

program to generate following pattern......


    *
   ***
  *****
 *******
*********



 */




#include<iostream.h>
#include<conio.h>
 

void main()
{
clrscr();
 

int i,j,r,a=1;
 

for(i=1;i<=5;i++)
 {
  for(j=5;j>i;j--)
   {
    cout<<" ";
   }
  for(r=1;r<=a;r++)
   {
    cout<<"*";
   }
  cout<<'\n';
  a+=2;
 }
 

getch();
}

Categories: ,

Related Posts:

  • Poker_SOLVED /* CODECHEF PROBLEM CODE : POKER  */ #include<stdio.h> int main() { int cases; int i,j; int temp; int rank[5]; char suit[5],space,ch;  scanf("%d%c",&cases,&sp… Read More
  • The Matrix Game_SOLVED /* CODECHEF PROBLEM CODE : SNCK01 */ #include <stdio.h> #define N 51 int M[N][N]; int main() { int n,m,sg,t,r,i,j; scanf("%d",&t); while(t--) { scanf("%d%d",&n,&m); for(i=… Read More
  • Delete SUBSTRING /* program to delete a part of string.... */ #include<iostream.h>#include<conio.h>#include<stdio.h>  void main(){  clrscr();char str[80];int a,b,c,i,j,k,len=0;  cout<<"Enter the str… Read More
  • The Next Palindrome_SOLVED /* CODECHEF PROBLEM CODE : PALIN */ #include <stdio.h> #include <stdlib.h> #include <string.h> char K[1000002]; int flag; int main()  { int t,i; scanf("%d\n",&t); for(i=… Read More
  • compound_interest /* program to compute compound interest... */  #include<iostream.h>#include<conio.h>#include<math.h>  void main()  {  float a,b,c,d,f,g;int e;  clrscr();  cout<<"Ent… Read More

0 comments:

Post a Comment

Copyright © 2025 UPgradeCODING | Powered by Blogger