Bigger

Friday, 14 November 2014

How to change text color in dos box /Turbo c++ compiler

---------------------------------------------------------------------
#include<conio.h>
int main()
{
int i;

 for (i=1;i<=10;i++)
{
textcolor(i);
cprintf("  %d  ",i);
}
getch();
return 0;
}
//textcolor is a function defined in conio.h library
--------------------------------------------------------------------------
output:-

Tuesday, 11 November 2014

How to use Sound function in c programming

#include<iostream.h>
#include<conio.h>
#include<dos.h>
void main()
{
int i;
clrscr();
for(i=150;i<=250;i++)
{
sound(i);
delay(100);
}
for(i=250;i>=250;i--)
{
sound(i);
delay(100);
}
nosound();
getch();
}

Sunday, 9 November 2014

Tower of Hanoi in C

------------------------------------------------------------------------------
#include<iostream>
#include<stdlib.h>
using namespace std;
void towers(int n,char source,char inter,char destination);
int main()
{
int n;
cout<<"\nEnter the number of disks";
cin>>n;
towers(n,'A','B','C');
return 0;
}

void towers(int n,char source,char inter,char destination)
{
//Moving 1 disk from A to C
if(n==1)
{
cout<<"\nMove disk 1 from A to C";
return ;
}
// move n-1 disks from A to B using C
towers(n-1,source,destination,inter);
cout<<"\nMove disk "<<n<<" from "<<source<<" to "<<destination;
//move n-1 disks from B to C USing A
towers(n-1,inter,source,destination);
}//end of the tower function

----------------------------------------------------------------
output:-



How to make a twinkling bulb in HTML/JScript

Learning Point :- This program basically tells that how we can change the
HTML data using JavaScript.....
------------------------------------------------------------------------------------
<html>
<head>
</head>
<body>
<img  id="myimage" src="off.jpg" height="150" width="100" onclick="myFunction()">
<script>
var myVar=setInterval(function(){myFunction()},300);
function myFunction()
{
var image=document.getElementById('myimage');
if(image.src.match("off.jpg"))
{
image.src="on.jpg";
}
else
{
image.src="off.jpg";
}
}
</script>
</body>
</html>

---------------------------------------------------------------------------------------
output:-
This will result in a bulb which is continuously switching on and off in every 300 ms(or 0.3 sec)
---------------------------------------------------------------------------------------------
Note:-You  should download 2 images of a bulb from google
1.)Image for off state (saved it with name off.png/jpg)
2.)Image for on state (saved it with name on.png/jpg)
---------------------------------------------------------------------------------------

Saturday, 8 November 2014

Christmas tree in C programming

--------------------------------------Christmas  tree in C Programming----------------------------------
#include<iostream>
using namespace std;

int  main()
{
for(int i=0;i<=2;i++)
{
for(int j=1;j<=3;j++)
{
for(int sp=5-j-i;sp>0;sp--)
{
cout<<" ";
}
for(int k=1;k<=(2*j+2*i-1);k++)
{
cout<<"*";
}
cout<<endl;
}
}
for(int l=1;l<=3;l++)
{
for(int m=1;m<=3;m++)
{
cout<<" ";
}
for(int n=1;n<=3;n++)
{
cout<<"*";
}
cout<<"\n";
}
}//brackets of main
------------------------------------------------------------------------------------------------------------
output:-








Bouncing Ball screensaver in C

Just Run it to see the magic....
-------------------------------------------------------------------------------------------------------------
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<dos.h>
int main()
{
clrscr();
randomize();
float ballx=rand()%76+2,bally=rand()%20+2;
float velx=1,vely=1;
int i=0;
while(!kbhit())
{
i++;
textcolor(i);
delay(100);
clrscr();
if(1)
{
if(ballx<2)
velx=-velx;
else if(ballx>78)
velx=-velx;
}
if(1)
{
if(bally<=1)
vely=-vely;
else if(bally>=23)
vely=-vely;

}
ballx+=velx;
bally+=vely;
gotoxy(ballx,bally);
cprintf("*");
}
getch();
return 0;
}

------------------------------------------------------------------------------------------------
Note:-This program will exclusively run in dosbox.... 

output:-
Moving the ball and get reflected back on striking the end of screen

If you want the video clip of it's output then just put a mail to me....


How to make screensaver in c programming

Just Run it to see the magic....
-------------------------------------------------------------------------------------------------------------
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<dos.h>
int main()
{
clrscr();
randomize();
float ballx=rand()%76+2,bally=rand()%20+2;
float velx=1,vely=1;
int i=0;
while(!kbhit())
{
i++;
textcolor(i);
delay(100);
clrscr();
if(1)
{
if(ballx<2)
velx=-velx;
else if(ballx>78)
velx=-velx;
}
if(1)
{
if(bally<=1)
vely=-vely;
else if(bally>=23)
vely=-vely;

}
ballx+=velx;
bally+=vely;
gotoxy(ballx,bally);
cprintf("SofTecH");
}
getch();
return 0;
}

------------------------------------------------------------------------------------------------
Note:-This program will exclusively run in dosbox.... 

output:-
Moving and name and get reflected back on striking the end of screen

If you want the video clip of it's output then just put a mail to me....


A shopping mall project in c++

------------------------------------Welcome to Our Mall-----------------------------------------------

#include<stdio.h>
#include<conio.h>
void main()
{
double amount=0;char ch1,ch2,ch3;char c;int c1;char yn1;int cf=0;
int q,q1,q2,q3,q4,q5,q6,q7,q8,q9,q10,q11,q12,q13,q14,q15,q16,q17,q18,q19=0;
double s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19=0;
clrscr();
printf("\n*****************************\n");
printf("\nWELCOME to our Shopping Mall.\n");
printf("\n*****************************");
do
{
fflush(stdin);
printf("\nWhich section would you like to enter ?");
printf("\n\n1.Clothing");
printf("\n2.The Cricket Shop");
printf("\n3.Xtreme Gadgets ");
scanf("%c",&ch1);
switch(ch1)
{
case '1':
s1=s2=s3=s16=0;q=q1=q2=q3=q16=0;amount=0;
do
{
s1=s2=s3=s16=0;
fflush(stdin);
printf("\n***WELCOME TO CLOTHING SECTION***\n");
printf("\nWhat would you like to buy ?");
printf("\n1.Shirt [Rs.999/-]");
printf("\n2.Jeans [Rs.749/-]");
printf("\n3.T-Shirt [Rs.799/-]");
printf("\n4.Pair of Shoes [Rs.1,400/-] ");
scanf("%d",&c1);
if(c1==1)
{
printf("\nEnter Quantity\n");
scanf("%d",&q);
s1=s1+(q*999);
q1=q1+q;
amount=amount+s1;
}
else if(c1==2)
{
printf("\nEnter Quantity\n");
scanf("%d",&q);
s2=s2+q*749;
q2=q2+q;
amount=amount+s2;
}
else if(c1==3)
{
printf("\nEnter Quantity\n");
scanf("%d",&q);
s3=s3+q*799;
q3=q3+q;
amount=amount+s3;
}
else if(c1==4)
{
printf("\nEnter Quantity\n");
scanf("%d",&q);
s16=s16+q*1400;
q16=q16+q;
amount=amount+s16;
}
else
{
printf("\nSorry, Invalid Choice!");
}
yn1=' ';
while(yn1!='Y' && yn1!='y' && yn1!='N' && yn1!='n')
{
printf("\nDo you want to buy anything else (Y/N) ?\n");
fflush(stdin);
scanf("%c",&yn1);
if(yn1!='Y'&&yn1!='y'&&yn1!='N'&&yn1!='n')
{
printf("\nSorry! Invalid Choice...Try Again!");
}
}
if(yn1=='N'||yn1=='n')
{
printf("Press 1 to CONFIRM your Order OR Press 0 to CANCEL ");
scanf("%d",&cf);
if(cf==1)
{
amount=amount+(((12.5)*amount)/100);
printf("\n**********BILL**********\n");
if(q1>0)
printf("\nNo. of Shirts = %d",q1);
if(q2>0)
printf("\nNo. of Jeans = %d",q2);
if(q3>0)
printf("\nNo. of T-Shirts = %d",q3);
if(q16>0)
printf("\nNo. of Pairs of Shoes = %d",q16);
printf("\n\nYour total amount is = %lf (Incl. of All Taxes)\n\nThankyou...We hope you visit us soon...",amount);
}
else if(cf==0)
{
printf("\nThankyou...We hope you visit us soon...");
}
}
}
while(yn1=='Y' || yn1=='y');
break;
case '2':
s9=s10=s11=s12=s13=s14=s15=0;q=q9=q10=q11=q12=q13=q14=q15=0;amount=0;
do
{
s9=s10=s11=s12=s13=s14=s15=0;
fflush(stdin);
printf("\n***WELCOME TO THE CRICKET SHOP***\n");
printf("\nWhat would you like to buy ?");
printf("\n1.Kookaburra Bat [Rs.1,500/-]");
printf("\n2.SG Bat [Rs.1,200/-]");
printf("\n3.Kookaburra Ball [Rs.300/-]");
printf("\n4.SG Ball [Rs.280/-]");
printf("\n5.Stumps Set [Rs.700/-]");
printf("\n6.Batting / Wicket-Keeping Gloves [Rs.1,100/-]");
printf("\n7.Full Cricket Kit [Rs.3,500/-] ");
scanf("%d",&c1);
if(c1==1)
{
printf("\nEnter Quantity\n");
scanf("%d",&q);
s9=s9+(q*1500);
q9=q9+q;
amount=amount+s9;
}
else if(c1==2)
{
printf("\nEnter Quantity\n");
scanf("%d",&q);
s10=s10+q*1200;
q10=q10+q;
amount=amount+s10;
}
else if(c1==3)
{
printf("\nEnter Quantity\n");
scanf("%d",&q);
s11=s11+q*300;
q11=q11+q;
amount=amount+s11;
}
else if(c1==4)
{
printf("\nEnter Quantity\n");
scanf("%d",&q);
s12=s12+q*280;
q12=q12+q;
amount=amount+s12;
}
else if(c1==5)
{
printf("\nEnter Quantity\n");
scanf("%d",&q);
s13=s13+q*700;
q13=q13+q;
amount=amount+s13;
}
else if(c1==6)
{
printf("\nEnter Quantity\n");
scanf("%d",&q);
s14=s14+q*1100;
q14=q14+q;
amount=amount+s14;
}
else if(c1==7)
{
printf("\nEnter Quantity\n");
scanf("%d",&q);
s15=s15+q*3500;
q15=q15+q;
amount=amount+s15;
}
else
{
printf("\nSorry, Invalid Choice!");
}
yn1=' ';
while(yn1!='Y' && yn1!='y' && yn1!='N' && yn1!='n')
{
printf("\nDo you want to buy anything else (Y/N) ?\n");
fflush(stdin);
scanf("%c",&yn1);
if(yn1!='Y'&&yn1!='y'&&yn1!='N'&&yn1!='n')
{
printf("\nSorry! Invalid Choice...Try Again!");
}
}
if(yn1=='N'||yn1=='n')
{
printf("\nPress 1 to CONFIRM your Order OR Press 0 to CANCEL ");
scanf("%d",&cf);
if(cf==1)
{
amount=amount+(((12.5)*amount)/100);
printf("\n**********BILL**********\n");
if(q9>0)
printf("\nNo. of Kookaburra Bats = %d",q9);
if(q10>0)
printf("\nNo. of SG Bats = %d",q10);
if(q11>0)
printf("\nNo. of Kookaburra Balls = %d",q11);
if(q12>0)
printf("\nNo. of SG Balls = %d",q12);
if(q13>0)
printf("\nNo. of Stumps Sets = %d",q13);
if(q14>0)
printf("\nNo. of Batting / Wicket-Keeping Gloves = %d",q14);
if(q15>0)
printf("\nNo. of Full Cricket Kits = %d",q15);
printf("\n\nYour total amount is = %lf (Incl. of All Taxes)\n\nThankyou...We hope you visit us soon...",amount);
}
else if(cf==0)
{
printf("\nThankyou...We hope you visit us soon...");
}
}
}
while(yn1=='y'||yn1=='Y');
break;
case '3':
s4=s5=s6=s7=s8=0;q=q4=q5=q6=q7=q8=q17=q18=q19=0;amount=0;
do
{
s4=s5=s6=s7=s8=0;
fflush(stdin);
printf("\n***WELCOME TO XTREME GADGETS***\n");
printf("\nWhat would you like to buy ?");
printf("\n1.Laptop [Rs.40,000/-]");
printf("\n2.PC [Rs.35,000/-]");
printf("\n3.Tablet [Rs.10,000/-]");
printf("\n4.Mobile Phone [Rs.20,000/-]");
printf("\n5.Television [Rs.50,000/-]");
printf("\n6.Digital Camera [Rs.25,000/-]");
printf("\n7.PlayStation 4 [Rs.30,000/-]");
printf("\n8.XBox 360 [Rs.20,000/-] ");
scanf("%d",&c1);
if(c1==1)
{
printf("\nEnter Quantity\n");
scanf("%d",&q);
s4=s4+(q*40000);
q4=q4+q;
amount=amount+s4;
}
else if(c1==2)
{
printf("\nEnter Quantity\n");
scanf("%d",&q);
s5=s5+q*35000;
q5=q5+q;
amount=amount+s5;
}
else if(c1==3)
{
printf("\nEnter Quantity\n");
scanf("%d",&q);
s6=s6+q*10000;
q6=q6+q;
amount=amount+s6;
}
else if(c1==4)
{
printf("\nEnter Quantity\n");
scanf("%d",&q);
s7=s7+q*20000;
q7=q7+q;
amount=amount+s7;
}
else if(c1==5)
{
printf("\nEnter Quantity\n");
scanf("%d",&q);
s8=s8+q*50000;
q8=q8+q;
amount=amount+s8;
}
else if(c1==6)
{
printf("\nEnter Quantity\n");
scanf("%d",&q);
s17=s17+q*25000;
q17=q17+q;
amount=amount+s17;
}
else if(c1==7)
{
printf("\nEnter Quantity\n");
scanf("%d",&q);
s18=s18+q*30000;
q18=q18+q;
amount=amount+s18;
}
else if(c1==8)
{
printf("\nEnter Quantity\n");
scanf("%d",&q);
s19=s19+q*20000;
q19=q19+q;
amount=amount+s19;
}
else
{
printf("\nSorry, Invalid Choice!");
}
yn1=' ';
while(yn1!='Y' && yn1!='y' && yn1!='N' && yn1!='n')
{
printf("\nDo you want to buy anything else (Y/N) ?\n");
fflush(stdin);
scanf("%c",&yn1);
if(yn1!='Y'&&yn1!='y'&&yn1!='N'&&yn1!='n')
{
printf("\nSorry! Invalid Choice...Try Again!");
}
}
if(yn1=='N'||yn1=='n')
{
printf("\nPress 1 to CONFIRM your Order OR Press 0 to CANCEL ");
scanf("%d",&cf);
if(cf==1)
{
amount=amount+(((12.5)*amount)/100);
printf("\n**********BILL**********\n");
if(q4>0)
printf("\nNo. of Laptops = %d",q4);
if(q5>0)
printf("\nNo. of PC's = %d",q5);
if(q6>0)
printf("\nNo. of Tablets = %d",q6);
if(q7>0)
printf("\nNo. of Mobile Phones = %d",q7);
if(q8>0)
printf("\nNo. of Televisions = %d",q8);
if(q17>0)
printf("\nNo. of Digital Cameras = %d",q17);
if(q18>0)
printf("\nNo. of PlayStation 4 = %d",q18);
if(q19>0)
printf("\nNo. of XBox 360 = %d",q19);
printf("\n\nYour total amount is = %lf (Incl. of All Taxes)\n\nThankyou...We hope you visit us soon.",amount);
}
else if(cf==0)
{
printf("\nThankyou...We hope you visit us soon...");
}
}
}
while(yn1=='y'||yn1=='Y');
break;
default:
printf("\nInvalid Choice...Please try again...");
}
c=' ';
while(c!='Y' && c!='y' && c!='N' && c!='n')
{
printf("\nDo you want to continue shopping (Y/N) ?\n");
fflush(stdin);
scanf("%c",&c);
if(c!='Y' && c!='y' && c!='N' && c!='n')
{
printf("\nSorry! Invalid Choice...Try Again!");
}
}
if(c=='n'||c=='N')
{
printf("\nThankyou for your visit...Have a nice day...");
}
}
while(c=='Y'||c=='y');
getch();
}

All in one program on Singly Linked List

//--------------------------------All about 1-way List..-------------------

#include<stdio.h>
#include<stdlib.h>
struct node
{
int info;
struct node * link;   
};
struct node *addatbeg(struct node *start,int num);
void addatend(struct node *start,int num);
int count(struct node *start);
void search(struct node *start,int num);
struct node * del(struct node *start,int num);
void display(struct node *start);
void addafter(struct node *start,int num,int num1);
struct node*addbef(struct node*start,int num,int num1);
struct node *reverse (struct node *start);
void alter (struct node * start);
void findmiddlenode(struct node*start);
void sort(struct node * start);
int main()
{
struct node * start=NULL;
int choice,num,num1;   
while(1)   
{
printf("\n-------------Enter the choice-----------\n");
printf("1.Display\n");
printf("2.Add at begin\n");
printf("3.Add at End\n");
printf("4.Add after the node\n");
printf("5.Add before the node\n");
printf("6.Delete a node\n");   
printf("7.Count number of nodes\n");
printf("8.Search an element\n");
printf("9.Reverse the list\n");
printf("10.Delete alternatively\n");
printf("11.Find Middle One\n");
printf("12.Sort the List\n");
printf("13.Exit\n");
scanf("%d",&choice);
switch(choice)
{
case 1:
display(start);
break;
case 2:
printf("Enter the element\n");
scanf("%d",&num);
start=addatbeg(start,num);
break;   
case 3:
printf("Enter the element\n");
scanf("%d",&num);
addatend(start,num);
break;
case 4:
printf("Enter the element\n");
scanf("%d",&num);
printf("Enter the element after which you want to add new node\n");
scanf("%d",&num1);
printf("Initaly our");
display(start);
addafter(start,num,num1);
printf("\nFinaly our");
display(start);
break;
case 5:
printf("Enter the element\n");
scanf("%d",&num);
printf("Enter the element before which you want to add new node\n");
scanf("%d",&num1);
printf("Initaly our");
display(start);
start=addbef(start,num,num1);
printf("\nFinaly our");
display(start);
break;
case 6:
printf("Enter the element you want to delete\n");
scanf("%d",&num);
start=del(start,num);
break;
case 7:
count(start);
break;
case 8:
printf("Enter the element to be searched\n");
scanf("%d",&num);
search(start,num);
break;
case 9:
printf("\nIntilally ");
display(start);
start=reverse(start);
printf("\nFinally ");
display(start);
break;   
case 10:
printf("\nIntilally ");
display(start);
alter(start);
printf("\nFinally ");
display(start);
break;
case 11:
findmiddlenode(start);   
break;
case 12:
printf("\nIntilally ");
display(start);
sort(start);
printf("\nFinally ");
display(start);
break;   
case 13:
printf("Terminating..........................\n");
exit(1);
break;
default:
printf("Invalid choice\n");   
}
}
return 0;   
}
void display(struct node * start)
{
if(start==NULL)
{
printf("The List is empty\n");   
return ;
}   
else
{
struct node *p=start;   
printf(" List is:- \n");
while(p!=NULL)
{
printf(" %d ",p->info);
p=p->link;   
}
}
}
struct node *addatbeg(struct node *start,int num)
{
struct node * temp;
temp=(struct node *)malloc(sizeof(struct node));
temp->info=num;   
temp->link=start;
start=temp;
return start;
}
void addatend(struct node *start,int num)
{
if(start==NULL)
{
printf("This function can't be used to insert element in an empty list\n");   
return ;
}
else
{
struct node * temp,*p;
p=start;
temp=(struct node *)malloc(sizeof(struct node));
temp->info=num;
while(p->link!=NULL)
{
p=p->link;   
}
p->link=temp;
temp->link=NULL;   
}   
}
int count(struct node *start)
{
if(start==NULL)
{
printf("The List is empty\n");
return 0;   
}   
else
{
struct node* p=start;
int total=0;
while(p!=NULL)
{
p=p->link;   
total++;
}
printf("The total number of nodes are:-%d\n",total);
return total;
}
}

void search(struct node* start,int num)
{
struct node*p=start;
int nm=0;
if(start==NULL)
{
printf("The List is empty\n");
return ;   
}
else
{
while(p!=NULL)
{
nm++;
if(p->info==num)
{
printf("%d is found at %d Node in List",num,nm);   
return ;
}
p=p->link;   
}
}
printf("%d is not found in our List\n",num);   
   
}
struct node * del(struct node *start,int num)
{   
if(start==NULL)   
{
printf("The List is empty");   
return start;
}
else
{
struct node*temp,*p=start;
if(start->info==num)
{
start=p->link;
free(p);
return start;   
}
while(p->link!=NULL)
{
if(p->link->info==num)
{
temp=p->link;
p->link=temp->link;
free(temp);
return start;   
}
p=p->link;
}
printf("%d is not found in the list",num);
return start;
}
}
void addafter(struct node *start,int num,int num1)
{
if(start==NULL)
{
printf("This function can't be used to insert element in an empty list\n");   
return ;
}
struct node*p,*temp;   
p=start;
temp=(struct node *)malloc(sizeof(struct node));
temp->info=num;
while(p!=NULL)
{
if(p->info==num1)
{
temp->link=p->link;
p->link=temp;
return ;   
}
p=p->link;   
}
printf("%d doesn't exist in the list",num1);
return ;
}

struct node *reverse (struct node *start)
{
if(start==NULL)
{
return start;   
}   
else
{
struct node *p=start,*q=NULL,*temp;
while(p!=NULL)
{
temp=p;
p=p->link;
temp->link=q;
q=temp;   
}
return(q);   
}
}
void alter (struct node * p)
{
if(p==NULL||p->link==NULL)   
{
return ;   
}
else
{
struct node* temp;
temp=p->link;
p->link=temp->link;
free(temp);   
alter(p->link);   
}
}
struct node*addbef(struct node*start,int num,int num1)
{
if(start==NULL)
{
printf("This fxn can't be used to add element to an empty List\n");
return start;   
}   
else
{
struct node*p=start,*temp,*pre=NULL;   
temp=(struct node*)malloc(sizeof(struct node));
while(p!=NULL)//doing search
{
if(p->info==num1)
{
if(p==start)
{
temp->info=num;
temp->link=start;
return(start=temp);   
}
else
{
temp->info=num;
temp->link=pre->link;
pre->link=temp;
return start;   
}   
}
pre=p;
p=p->link;   
}
printf("No Such node %d is found\n",num1);
return start;
}
}
void findmiddlenode(struct node*start)
{
if(start==NULL)
{
printf("List is empty");
return ;   
}   
else
{
int what=count(start),c=0;   
struct node *p=start;
if(what%2==0)
{
printf("There are 2 middle nodes\n");
while(p->link!=NULL)
{
c++;
if(c==(what/2)||c==(what/2+1))
{
printf("%d is the middle node and data stored here is %d\n",c,p->info);   
}   
p=p->link;   
}
}   
else
{
printf("There is only 1 middle node\n");
while(p->link!=NULL)
{
c++;
if(c==((what+1)/2))
{
printf("%d is the middle node and data stored here is %d\n",c,p->info);   
}   
p=p->link;   
}
}
}
}

void sort(struct node * start)
{
if(start==NULL)
{
printf("The List is empty\n");
return ;   
}
else
{
int temp;
struct node *p=start;

while(p->link!=NULL)
{
if(p->info>p->link->info)
{
temp=p->info;
p->info=p->link->info;
p->link->info=temp;   
p=p->link;
}   
}   
}   
}

Program to make a butterfly in c++ programming

---------------------Program to make a butterfly in C++ programming---------------------------------

#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<dos.h>
void main()
{
int i,l,j,sp,u,s,t=0;
clrscr();
char * b=("***************");
l=strlen(b);
u=2*l-2;
for(i=1;i<=l;i++)
{
textcolor(i);
delay(300);
cout.write(b,i);
for(sp=u;sp>=0;sp=sp-1)
{
cout<<" ";
}
cout.write(b,i);
cout<<"\n";
u=u-2;
}
for(j=l;j>0;j--)
{
delay(300);
cout.write(b,j);
for(s=0;s<=t;s++)
{
cout<<" ";
}
cout.write(b,j);
cout<<"\n";
t=t+2;
}
getch();
}


Note---This program will run only in dos box....

It's output look's like :-