Simple programs to print star pattern in c
Posted by Nikhil Chawra 6/30/2012
Here there are some examples of Star pattern programs in c
Print the stars
You can also read this :-
Number Pattern Programs in C
How To Play Sounds In C Language
pattern1 : Print the stars
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,n;
clrscr();
printf("\nEneter the no of lines to be printed: ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<=i;j++)
{
printf("*");
}
printf("\n");
}
getch();
}
Star pattern 2
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,n;
clrscr();
printf("\nEneter the no of lines to be printed: ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=n-i;j>1;j--)
{
printf(" ");
}
for(j=0;j<=i;j++)
{
printf("*");
}
printf("\n");
}
getch();
}
Star pattern 3
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,n,k;
clrscr();
printf("\nEnter the no of lines to be printed: ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<n-i;j++)
{
printf("*");
}
for(k=0;k<(2*n-2*j);k++)
{
printf(" "); //for spaces
}
for(j=0;j<n-i;j++)
{
printf("*");
}
printf("\n");
}
getch();
}
Star pattern 4
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,n,k;
clrscr();
printf("\nEnter the no of lines to be printed: ");
scanf("%d",&n);
printf("\n\n");
for(i=0;i<n;i++)
{
for(j=0;j<n-i;j++)
{
printf("*");
}
for(k=0;k<(2*n-2*j);k++)
{
printf(" ");
}
for(j=0;j<n-i;j++)
{
printf("*");
}
printf("\n");
}
for(i=0;i<n;i++)
{
for(j=0;j<=i;j++)
{
printf("*");
}
for(k=2*n-2*j;k>0;k--)
{
printf(" ");
}
for(j=0;j<=i;j++)
{
printf("*");
}
printf("\n");
}
getch();
}
Star pattern 5
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,k,n;
clrscr();
printf("\nEnter the no lines to be printed: ");
scanf("%d",&n);
printf("\n\n");
for(i=0;i<n;i++)
{
for(j=0;j<(n-i-1);j++)
printf(" ");
for(k=0;k<(2*i+1);k++)
printf("*");
printf("\n");
}
for(i=0;i<n-1;i++)
{
for(j=0;j<=i;j++)
printf(" ");
for(k=(2*n-2*i-3);k>0;k--)
printf("*");
printf("\n");
}
}
Star pattern :6 [Diamond pattern]
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,k,n;
clrscr();
printf("Enter the number of lines to be printed");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=n-i-1;j>0;j--)
printf(" ");
printf("*");
for(k=2*i-1;k>0;k--)
printf(" "); //code for upper triangle
if(i!=0)
printf("*");
printf("\n");
}
for(i=n-1;i>0;i--)
{
for(j=0;j<n-i;j++)
printf(" ");
printf("*"); //code for lower triangle
for(k=2*i-3;k>0;k--)
printf(" ");
if(i!=1)
printf("*");
printf("\n");
}
getch();
}
pattern 7:program for simple star pyramid
simple star pyramid |
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,k,n;
//clrscr();
printf("Enter the number of lines to be ptinted");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=i;j<n;j++)
{
printf(" "); // spaces
}
for(k=0;k<2*i-1;k++)
{
printf("*"); // star
}
printf("\n");
}
}
pattern 8:program for simple star pyramid in reverse order
star pyramid reverse |
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,k,n;
//clrscr();
printf("Enter the number of lines to be ptinted");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<i;j++)
{
printf(" ");
}
for(k=2*(n-i)+1;k>1 ;k--)
{
printf("*");
}
printf("\n");
}
}
The program below is good program can be asked for coding compititions
pattern 9: program for arrow pattern
arrow pattern |
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,k,n;
clrscr();
printf("Enter the number of lines to be ptinted");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<i;j++)
{
printf(" ");
}
for(k=0;k<i;k++)
{
printf("*");
}
printf("\n");
} for(i=0;i<n;i++)
{
for(j=0;j<n-i;j++)
{
printf(" ");
}
for(k=0;k<n-i;k++)
{
printf("*");
}
printf("\n");
}
}
pattern 10: Not that Simple program to print hollow pattern triangle.
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,k,n;
clrscr();
printf("Enter the number of lines to be printed:");
scanf("%d",&n);
printf("\n");
for(i=1;i<2*(n-2);i++)
printf(" ");
printf("*\n");
for(i=1;i<n-1;i++)
{
for(j=n-i;j>0;j--)
printf(" ");
printf("*");
for(k=0;k<2*i-1;k++)
printf(" ");
printf("*\n");
}
printf(" ");
for(i=0;i<2*n-1;i++)
printf("*");
}
pattern 11: Simple Square pattern program in c
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,k,n;
clrscr();
printf("Enter the number of lines to be printed:");
scanf("%d",&n);
for(i=0;i<n;i++)
printf("*");
printf("\n");
for(i=0;i<n-2;i++)
{
printf("*");
for(j=0;j<n-2;j++)
printf(" ");
printf("*\n");
}
for(i=0;i<n;i++)
printf("*");
}
3 Ticks to run Turbo C++ in Windows 7 in full Screen [Updated]
Posted by Nikhil Chawra 6/30/2012
First of all, DOwnload Tc for c Language [link updated]
When you try to run turbo c++ IDE on latest version of windows like Windows7 or Vista, you may get the error message that 'The system does not support full screen mode. Choose close to terminate the application.'
When you try to run turbo c++ IDE on latest version of windows like Windows7 or Vista, you may get the error message that 'The system does not support full screen mode. Choose close to terminate the application.'
The problem is that turbo C is
very old DOS program. It's better to move on to an up to date compiler
like visual c++ Express which is free and you certainly would have a
better experience.
Anyway if you are up with turbo
c++ and used to it, I have 3 tricks to run it full screen on windows7
and vista. The tricks can be simply classified based on which works on
all versions of windows7 and one which only works under Windows 7
Enterprise, Windows 7 Professional, and Windows 7 Ultimate.
Technique 1
Log on to windows7 in safe mode.
In safe mode the application running capabilities of an operating
system is low and this mode is used as trouble fixing for OS. But this
method is much simpler and you only need to log on to safe mode by
pressing F8 on start up.
By summarizing the steps:
- Install turbo C++
- Start windows7 in safe mode.
- Execute turbo C++
Technique 2
By Disabling your graphics adapter. This trick is done by just uninstalling the graphics driver. To do that
- Right click on My Computer, click Properties
- Select Device manager->Display Adapters
- Identify the display adapter of your computer, and uninstall.
You should try this trick only if
you do not use your computer for Graphic related operations like
playing multimedia games.By this trick graphics would look vulgar but
you can run C++ in full screen.
Technique 3
By using DOSBox software. It is an
open source DOS emulator for BeOS, Linux, Mac OS X, OS/2, and Windows.
This tool is primarily intended to play DOS games on windows7 but here
we can use it run turbo C++ in Full screen mode.
- Download DOSBox frome here. (for windows)
- Install and run the DOSBox.
- Now a command prompt type window will appear. We need to mount TC folder.
Just type “mount c: c:/tc” and press enter.
- Assumed that Turbo C++ is installed in C drive and TC folders located at C:\TC
- You may get a message that 'Drive C is mounted as local directory C:/TC\'
- Change the directory to C/BIN/tc.exe. To do that, please follow the steps as shown in the below screen shot.
Now the Turbo C++ will open in DOSBox. Press ALT+ENTER to toggle between full screen and mini screen.
By applying the above 3 tricks, you can run C compiler on full screen mode in windows 7.
How To divert SMS Of Your Number To Another Number Or Email Account
Posted by Nikhil Chawra 6/30/2012
You may read this :-
Send Free Sms through Gmail
But Have You Ever Think About SMS diverting...I Think Yes...But No mobile Operator Supports SMS diverting... :(
Thats Why Today I am Going To write A Small Tutorial On SMS diverting By Which You Can Able To divert Your SMS From Any Number To Another Number..
So Here's The Trick...
NOTE : This Trick Is Only For Android Phones..If You Have Nokia,Samsung Or Other Device Then Stay Tuned With Us...I will Shortly Give The Trick For Them Also..
STEP 1: Go To Android Market From Your Android Phone.
STEP 2: Search For A application Named "Sms Forwarding" ...Download This And Install This Application..
SMS FORWARDING is a software For Android Based Mobile Phone Which Supports Missed calls And SMS Forwarding To Another Mobile Number Or Email Address..
STEP 3: Open Software..You will See Something Like This..
Click Mark On "Enable Forwarding"
STEP 4:if You want To forward Your Message To Another Phone number Then
Click Mark On "Forward With Sms"
And Enter Another Number In "Destination Number" Field..
STEP 5: IF you want To Forward Sms And Miss Call Information To Your Email Then Follow This Step and Don't Follow STEP 4.
Click Mark On "Forward with Email."
Then Enter Your Recipients mail address list in "Email Of Recipients" Field..
You Have To Enter A Outgoing Mail Account From Which Mail Will Be Send To Your Email List...
Enter Any Valid Email Address In "Outgoing Mail Account" Section.
You Have To Enter Password of Your Mail Account Also...Enter Your Email Address Password In "Password Of Outgoing Account".
You Can Also Able To Delete The Forwarded Message By Click Mark On "Delete Forwarded Message."
Top Ways to Speed Up PC
Posted by Nikhil Chawra 6/29/2012
Perfect optimizer:
Perfect Optimizer is a simple and easy-to-use program which will optimize your PC and fix computer problems like slow speed, blue screen, deadlock errors and other annoying problems to maintain system stability and security, keep your PC running smoother and improve its overall performance.
Download Perfect Optimizer
Protect your computer against a spywares:
Spywares can really slow your Pc and hurt its performance,The best way to protect your computer against spywares is By installing an antispyware software,I have made an article on To protect your computer against Spywares and keyloggers use Keyscrabler & AVG PC TUNER consider reading it
Spywares can really slow your Pc and hurt its performance,The best way to protect your computer against spywares is By installing an antispyware software,I have made an article on To protect your computer against Spywares and keyloggers use Keyscrabler & AVG PC TUNER consider reading it
By freeing disk space, you can improve the performance of your computer. The Disk Cleanup tool helps you free up space on your hard disk. The utility identifies files that you can safely delete, and then enables you to choose whether you want to delete some or all of the identified files.
You can also do it manually read this :-
SLOW PC ? MAKE YOUR PC FASTER 100% WORKING
Detect and repair disk errors:
In addition to running Disk Cleanup and Disk Defragmenter to speed up your slow pc, you can check the integrity of the files stored on your hard disk by running the Error Checking utility.
This will speed up your slow pc with a few clicks. This is one of the best answers to "how to speed up PC performance?". These easy point and click programs also defrag your hard drive and remove spyware. All that with the push of a button weekly will keep your computer running at it’s original PC speed specs. There are dozens of different registry cleaners software and registry cleaner tools available for use with the registry, However only about 5 have really proven themselves based on user support. One of the industry leaders is RegFix. It was last year's Most Popular PC Repair product. RegFix is the easiest and best. It’s easy to get scammed with inferior products so it’s best to choose a registry cleaner with an excellent record.
?
+
X
Recommended for you
Loading..