Wednesday, August 24, 2011

c program to print patterns, pyramids of numbers and stars



These program prints various different patterns of numbers and stars. These codes illustrate how to create various patterns using c programming. Most of these c programs involve usage of nested loops and space. A pattern of numbers, star or characters is a way of arranging these in some logical manner or they may form a sequence. Some of these patterns are triangles which have special importance in mathematics. Some patterns are symmetrical while other are not. Please see the complete page and look at comments for many different patterns.
*
   ***
  *****
 *******
*********
We have shown five rows above, in the program you will be asked to enter the numbers of rows you want to print in the pyramid of stars.

C code


#include
#include
 
main()
{
   int row, c, n, temp;
 
   printf("Enter the number of rows in pyramid of stars you wish to see ");
   scanf("%d",&n);
 
   temp = n;
 
   for ( row = 1 ; row <= n ; row++ )
   {
      for ( c = 1 ; c < temp ; c++ )
         printf(" ");
 
      temp--;
 
      for ( c = 1 ; c <= 2*row - 1 ; c++ )
         printf("*");
 
      printf("\n");
   }
 
   getch();
   return 0;
}

Output:

stars pyramid
Consider the pattern
*
**
***
****
*****
to print above pattern see the code below:
#include
 
main()
{
    int n, c, k;
 
    printf("Enter number of rows\n");
    scanf("%d",&n);
 
    for ( c = 1 ; c <= n ; c++ )
    {
        for( k = 1 ; k <= c ; k++ )
            printf("*");
 
        printf("\n");
    }
 
    return 0;
}

For more patterns or shapes on numbers and characters see comments below and also see codes on following pages:
Floyd triangle
Pascal triangle

Comments


#1 Guest : i need code of this pattern

A B C D E F G H
 A B C D E F G
  A B C D E F 
   A B C D E
    A B C D 
     A B C
      A B
       A

#2 adminPs : c program for character pattern


#include
 
main()
{
      char ch = 'A';
      int n, c, k, space = 0;
 
      scanf("%d", &n);
 
      for ( k = n ; k >= 1 ; k-- )
      {
          for ( c = 1 ; c <= space ; c++)
              printf(" ");
 
          space++;
 
          for ( c = 1 ; c <= k ; c++ )
          {
             printf("%c ", ch); 
             ch++;
          }
 
          printf("\n");
          ch = 'A';
      }
 
      return 0;
}

for this type:

1
01
010
1010
10101

 c program to print pattern


#include
 
main()
{
      int n, c, k, num = 1;
 
      scanf("%d", &n);
 
      for ( c = 1 ; c <= n ; c++ )
      {
          for ( k = 1 ; k <= c ; k++ )
          {
              printf("%d", num);
 
              if ( num == 0 )
                 num = 1;
              else
                 num = 0;
          }
          printf("\n");
      }
 
      return 0;
}

 can you write code for this

p
pr
pro
prog
progr
progra
program

: pattern for string

Just input the string and press enter, corresponding pattern will be printed.

#include
#include
 
main()
{
      char string[100];
      int c, k, length;
 
      printf("Enter a string\n");
      gets(string);
 
      length = strlen(string);
 
      for ( c = 0 ; c < length ; c++ )
      {
          for( k = 0 ; k <= c ; k++ )
          {
               printf("%c", string[k]);
          }
          printf("\n");
      }
 
      return 0;
}

 c programming code

please get me the code of the c program to get the output as follows:
1
121
12321
1234321
123454321

 c program to print number pattern


#include
 
main()
{
      int n, c, k, x = 1;
 
      scanf("%d", &n);
 
      for ( c = 1 ; c <= n ; c++ )
      {
          for ( k = 1 ; k <= c ; k++ )
          {
              printf("%d", x);
              x++;
          }
 
          x--;
 
          for ( k = 1 ; k <= c - 1 ; k++ )
          {
              x--;
              printf("%d", x);
          }
 
          printf("\n");
          x = 1;
      }
 
      return 0;
}

 c++ code to print pattern

1   1
12 21
12321

 c++ code to print pattern


#include
 
using namespace std;
 
main()
{
      int n, k, c, space, x, num = 1;
 
      cin >> n;
 
      x = n;
 
      for ( k = 1 ; k <= n ; k++ )
      {
          for ( c = 1 ; c <= k ; c++ )
          {
             cout << num;
             num++;
          }
 
          num--;
 
          for ( c = 1 ; c <= 2*x - 3 ; c++ )
              cout << " ";
 
          x--;
 
          if ( k != n )
          {
             for ( c = 1 ; c <= k  ; c++ )
             {
                cout << num;
                num--;
             }
          }
          else
          {
              num--;
              for ( c = 1 ; c <= k - 1 ; c++ )
              {
                 cout << num;
                 num--;
              }
          }
 
          printf("\n");
          num = 1;
      }    
 
      return 0;
}

 may i get its source code

1
       232
      34543
     4567654
    567898765   

 c code for number pattern


#include
 
main()
{
      int n, c, d, num = 1, space;
 
      scanf("%d",&n);
 
      space = n - 1;
 
      for ( d = 1 ; d <= n ; d++ )
      {
          num = d;
 
          for ( c = 1 ; c <= space ; c++ )
              printf(" ");
 
          space--;
 
          for ( c = 1 ; c <= d ; c++ )
          {
              printf("%d", num);
              num++;
          }
          num--;
          num--;
          for ( c = 1 ; c < d ; c++)
          {
              printf("%d", num);
              num--;
          }
          printf("\n");
 
      }
 
      return 0;
}

how to print this pattern

*******
***S***
**SSS**
*SSSSS*
where S represents Space
*******
*** ***
**   **
*     *

#14 adminPs : c code for star pattern


#include
 
main()
{
    int n, c, k, space, r;
 
    printf("Enter number of rows\n");
    scanf("%d",&n);
 
    space = 1;
    r = n-1;
 
    for( c = 1 ; c <= 2*n - 1 ; c++ )
         printf("*");
 
    printf("\n");
 
    for ( k = 2 ; k <= n ; k++ )
    {
 
        for( c = 1 ; c <= r ; c++ )
            printf("*");
 
        for ( c = 1 ; c <= space ; c++ )
            printf(" ");
 
        space = 2*k-1; 
 
        for( c = 1 ; c <= r ; c++ )
            printf("*");
        r--;
 
        printf("\n");
    }
 
    return 0;
}



In the program, instead of the statement space=2*k-1; , can we go for the statement, space+=2; ?



You can use but don't forget to initialize variable space to one.
 need the code for this
* 
   **
  ***
 ****
*****

 star pattern source code



#include
 
main()
{
    int n, c, k, space;
 
    printf("Enter number of rows\n");
    scanf("%d",&n);
 
    space = n;
 
    for ( k = 1 ; k <= n ; k++ )
    {
        for ( c = 1 ; c < space ; c++ )
            printf(" ");
 
        space--; 
 
        for( c = 1 ; c <= k ; c++ )
            printf("*");
 
        printf("\n");
    }
 
    return 0;
}

need a program to draw the below patern?

1
22
333
4444
55555

#20 adminPs : number pattern source code



#include
 
main()
{
    int n, c, k;
 
    printf("Enter number of rows\n");
    scanf("%d",&n);
 
    for ( c = 1 ; c <= n ; c++ )
    {
        for( k = 1 ; k <= c ; k++ )
            printf("%d", c);
 
        printf("\n");
    }
 
    return 0;
}

need help

i need program to print the following pattern ::
1
2 3
4 5 6
7 8 9 10

Floyd's triangle

This pattern is Floyd's triangle see Floyd's Triangle code.

need a code in c to print below pattern

i want a code to print stars like below
*
**
***
****
***
**
*

 stars pattern using c programming



#include
 
main()
{
    int n, c, k;
 
    printf("Enter number of rows\n");
    scanf("%d",&n);
 
    for ( c = 1 ; c <= n ; c++)
    {
        for ( k = 1 ; k <= c ; k++ )
            printf("*");
 
        printf("\n");
    }
 
    for ( c = n - 2 ; c >= 0 ; c-- )
    {
        for ( k = c ; k >= 0 ; k-- )
            printf("*");
 
        printf("\n");
    }
 
    return 0;
}

GET ME THE CODE OF A PROGRAM

GET ME THE CODE OF A PROGRAM TO GET OUTPUT AS FOLLOWS:
*
  *A*
 *A*A*
*A*A*A*    

 code to print pattern of stars and numbers



#include
 
main()
{
    int n, c, k, space, count = 1;
 
    printf("Enter number of rows\n");
    scanf("%d",&n);
 
    space = n;
 
    for ( c = 1 ; c <= n ; c++)
    {
        for( k = 1 ; k < space ; k++)
           printf(" ");
 
        for ( k = 1 ; k <= c ; k++)
        {
            printf("*");
 
            if ( c > 1 && count < c)
            {
                 printf("A");    
                 count++; 
            }      
        }    
 
        printf("\n");

Saturday, July 23, 2011

Permanent account number(PAN)

Permanent Account Number (PAN) is unique alphanumeric combination issued to all juristic entities identifiable under the Indian Income Tax Act 1961. It is issued by the Indian Income Tax Department under the auspices of the Central Board for Direct Taxes (CBDT) and is almost equivalent to a national identification number. It also serves as an important ID proof.
This number is almost mandatory for financial transactions such as opening a bank account, receiving taxable salary or professional fees, sale or purchase of assets above specified limits.
The primary purpose of PAN is to bring a universal identification key factor for all financial transactions and indirectly prevent tax evasion by keeping a track of monetary transactions of high net worth individuals.
The PAN is unique, national, and permanent. It is unaffected by a change of address, even between states.

Structure and validation

  • PAN structure is as follows: AAAAA9999A: First five characters are letters, next 4 numerals, last character letter
  • Each assesse is uniquely identified by the PAN
  • If the PAN does not follow the above structure, then the PAN will be shown invalid
  • The fourth character of the PAN must be one of the following, depending on the type of assesse:
C — Company
P — Person
H — HUF(Hindu Undivided Family)
F — Firm
A — Association of Persons (AOP)
T — AOP (Trust)
B — Body of Individuals (BOI)
L — Local Authority
J — Artificial Juridical Person
G — Govt

  • The fifth character of the PAN is the first character (a) of the surname / last name of the person, in the case of a "Personal" PAN card, where the fourth character is "P" or (b) of the name of the Entity/ Trust/ Society/ Organisation in the case of Company/ HUF/ Firm/ AOP/ BOI/ Local Authority/ Artificial Jurdical Person/ Govt, where the fourth character is "C","H","F","A","T","B","L","J","G".
Nowadays, the DOI (Date of Issue) of PAN card is mentioned at the right (vertical) hand side of the photo on the PAN card.

Monday, July 18, 2011

A new beginning...Diploma to Degree

After spending three years of my life,studying Diploma,now time arises for a new beginning and a new challenge to be a degree student. It is my luck that God has blessed me so much and i'd hope that He'l be my guide again in this new challenges. Because without God no man in this world cannot be succeed in life . It is the fact that behind person capabilities God used to be there,ready for helping.

Thursday, May 19, 2011

Presenting the Gibson Tribal Explorer

04.09.2009

Introduced in 1958, the Gibson Explorer has been a symbol of rock extremism for more than 50 years. It was too radical for many players in its day, but when hard rock and heavy metal came to town in the late ’60s and early ’70s, an Explorer was the ultimate guitar to be seen with, a total declaration of crushing rock action. Through the years, it has also become a beloved instrument in the hands of a wide range of guitar stars of all genres, from Eric Clapton to U2’s The Edge. Now, the latest issue in Gibson’s Limited Run Series takes the classic Explorer format to the next level in the form of the Tribal Explorer, an instrument honed for the contemporary rock and shred player. Available from early April 2009, it will be produced in a strictly limited run of 350 guitars, and is destined to appeal to the collector just as much as the player.
Eviscerating Looks
The original Explorer is a tough act to follow, looks wise, but the Tribal Explorer heaps on a bucketload of added edge and attitude. Its solid mahogany body and neck are dressed in a custom white finish and decorated on its body and headstock with this Limited Run model’s exclusive black Tribal Pattern design. Its unbound ebony fingerboard with acrylic dot position markers provide an austere contrast on this unique but businesslike rock tool, while black chrome hardware and white pickup mounting rings complete the package.
Land Speed Record
The Tribal Explorer updates the original Explorer’s iconic lines with a sizzling new power train designed to offer the muscle and versatility demanded by the 21st century rocker. A pair of Gibson’s own uncovered ceramic-magnet humbucking pickups—a 496R in the neck and a 500T in the bridge—maximize output and sustain while retaining clarity and string definition. Through a clean channel, they offer thumping lows and sweet highs; injected into a high-gain amp, however, they really come into their own, yielding eviscerating midrange and sizzling lead tones, with nearly endless sustain when desired.
Diving and Dancing
The Tribal Explorer adds an extra dimension to the rock action with a factory mounted Kahler Tremolo system. The ultimate tailpiece for anything from deep divebombing to subtle vibrato effects, the Kahler is partnered by a Corian nut and locking Grover kidney tuners to get it all right back to pitch, however extreme your action. The entire package is rendered with Gibson’s legendary playability, with 22 jumbo frets, and a 24-3/4" scale length.
Too Hot to Handle
Whether you’re a player seeking a professional rock instrument that’s totally uncompromised in both looks and performance, or a collector in search of that ultimate trophy piece, the Tribal Explorer is an axe worth grinding. Get in there quickly, because they won’t last long. The Limited Run from Gibson USA is restricted to 350 guitars, so contact your authorized Gibson dealer today. Each comes with a black Gibson hardshell case with white interior and Gibson USA logo.

Full specifications include:
Made In: Nashville, TN USA
Body Wood: Mahogany
Finish: White with black Tribal Pattern
Neck Wood: Mahogany
Nut: Corian
Neck Joint: Set; Glued-in
Fingerboard: Ebony with acrylic dots
Scale Length: 24-3/4"
Fingerboard Radius: 12"
Frets: 22
Tuners: Grover mini, locking
Hardware: Black Chrome
Pickups: 496R neck, 500T bridge
Controls: Two Volume control, one Tone control, three-way switch
Bridge:            Kahler Vibrato system
Includes: Hardshell case and 2009 Limited Run Series certificate of authenticity

Thursday, May 5, 2011

My Farewell songs to Seniors

 DUHSAKNA NEN
                       -Manx Inbuon

#Hringnun lamtluang zawh zelin,
 Zirna run sang kan lawi za e;
 Kan hmahruaitu ni turin,
 Run dang in belh a hun ta e.

   *A va nuam em! kan hlimlai ni-
    Kan zai,kan lam,kan chham!
    A nuam a ni,kan thlah phal lo,
    Kan thlah phal mawlh lo che u a ni.

##Kan lawm e,kawng engkimah,
  Kan hlim e,in thlazar hnuaiah;
  Kan hmu, zirtur, in nunah,
  Hlawhtlinna rahbi,chahbi ngei chu.

   -Kan nghilh lon'g e!kan hlimlai ni-
    Kan vawng reng ang thinlaia'n;
    Tu'n an zuam lo 'Duhtak mangtha'-
    Tih hi, Khuanu remruat a ni si.
   
###Duhsakna tinreng kan hlan che u-
   In thiamna, finna Siamtu tan
   Damtakin kan mangtha a che U
   Kawng engkim a duhsakna nen.
  
   -Repeat *