03 June, 2013

C/C++ Program To Perform Character Design : #01

This Post Contains A C & C++ Program To Perform Character Design With Correct Source Code, Algorithm & Output. This Program Is Written, Compiled & Executed At Turbo C/C++3.0 Compiler & Will Help You To Understand The Concept Of 'Nested For-Loops' From C & C++ Language. It Is A Well-Structured Program With Proper Comments Which Provides Step-By-Step Description Of Various Features Of The Language In A Simple & Easy-To-Understand Way.
 
# Note : You Can Simply Copy-Paste The Following Program Or Code Into Compiler For Direct Result.

  

C Program To Perform Character Design : #01
/* Declaration Of Header Files */
#include <stdio.h>
#include <conio.h>

/* Start Of Main Program */
int main()
{

 /* Declaration Of Variables */
 int num=0, row=0, col=0;

 /* Asking For The Input From User */
 printf(" \n Enter The Number Of Rows : ");
 scanf("%d",&num);

 /* Source Code For Character Design */
 for(row=1; num>=row; row++)
 {

      for(col=1; col<=num; col++)

            printf("@");

      printf("\n");
 }

 getch();

 return 0;
}

/* End Of Main Program */
Output:
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@

C++ Program To Perform Character Design : #01
/* Declaration Of Header Files */
#include <iostream..h>
#include <conio.h>

/* Start Of Main Program */
int main()
{

 /* Declaration Of Variables */
 int num=0, row=0, col=0;

 /* Asking For The Input From User */
 cout  <<  " \n Enter The Number Of Rows : ";
 cin  >>  num;

 /* Source Code For Character Design */
 for(row=1; num>=row; row++)
 {
      for(col=1; col <= num; col++)
            cout  <<  "@";
      cout  <<  "\n";
 }

 getch();

 return 0;

}
/* End Of Main Program */
Output:
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@




No comments:

Post a Comment

Subscribe To:

Most Commonly Asked Programs In 'C' & 'C++' Language.

Blog Archive