Pattern Codes, ABCDE Code, Arduino Code

Showing posts with label Pattern Codes. Show all posts
Showing posts with label Pattern Codes. Show all posts

Saturday, 14 January 2017

Reverse Right Angle Triangle Star Pattern

Reverse Right Angle Triangle Star Pattern

Output:

Enter the number of your choice5

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

Code:

#include<stdio.h>

int main()
 {
int i,j,k, n;
printf("\n Enter the number of your choice");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(k=0;k<i;k++)
{
printf(" ");
}
for(j=n;j>i;j--)
{
printf("*");
}
printf("\n");
}
}

Star Triangle Pattern in C


Star Traingle Pattern in c

Output:

 Enter the number of your choice5
     *
    * *
   * * *
  * * * *
 * * * * *

Code:

#include<stdio.h>

int main()
  {
int i,j,k, n;
printf("\n Enter the number of your choice");
scanf("%d",&n);
for(i=0;i<n;i++)                        //outer loop for each row
{
for(k=n;k>i;k--)
{
printf(" ");                   //1st inner loop for space
}
for(j=0;j<i;j++)                   //2nd inner loop for printing star
{
printf("* ");
}
printf("\n");
}
}

Friday, 13 January 2017

Right Angle Star pattern in c

Right angle Star Pattern in C

Output:

 enter the number of your choice 5
*
**
***
****
*****
******

Code:
#include<stdio.h>

int main()
 {
int i,j,n;
printf("\n enter the number of your choice");
scanf("%d",&n);
for(i=0;i<=n;i++)
{
for(j=0;j<=i;j++)
{
printf("*");
}
printf("\n");
}
return 0;
}

ABCDE pattern in c

Print ABCDE pattern in c

Output:

ABCDEFGHGFEDCBA
ABCDEFGGFEDCBA
ABCDEFFEDCBA
ABCDEEDCBA
ABCDDCBA
ABCCBA
ABBA
AA

Code:

#include<stdio.h>

int main()
{ int i,j,k;
char ch = 'A';
char n;
printf("\n Enter the charachter of  your choice");
scanf("%c",&n);
k = n;
for(i = ch ;i<= n; i++)
{ ch = 'A';
for(j=n; j>=i; j--)
{ printf("%c",ch);
ch++;
}
if(k==n)
{ ch--;
for(k = n-2;k>=j;k--)
{ch--;
printf("%c",ch);
}
}
else
{for(k = n-1;k>=j;k--)
{ch--;
printf("%c",ch);
}
}
printf("\n");
}
}

Rolls Royce

Rolls Royce
Amazing Cars

About Me