Dec | Hex | Oct | Char | Description |
---|---|---|---|---|
0 | 0 | 000 | null | |
1 | 1 | 001 | start of heading | |
2 | 2 | 002 | start of text | |
3 | 3 | 003 | end of text | |
4 | 4 | 004 | end of transmission | |
5 | 5 | 005 | enquiry | |
6 | 6 | 006 | acknowledge | |
7 | 7 | 007 | bell | |
8 | 8 | 010 | backspace | |
9 | 9 | 011 | horizontal tab | |
10 | A | 012 | new line | |
11 | B | 013 | vertical tab | |
12 | C | 014 | new page | |
13 | D | 015 | carriage return | |
14 | E | 016 | shift out | |
15 | F | 017 | shift in | |
16 | 10 | 020 | data link escape | |
17 | 11 | 021 | device control 1 | |
18 | 12 | 022 | device control 2 | |
19 | 13 | 023 | device control 3 | |
20 | 14 | 024 | device control 4 | |
21 | 15 | 025 | negative acknowledge | |
22 | 16 | 026 | synchronous idle | |
23 | 17 | 027 | end of trans. block | |
24 | 18 | 030 | cancel | |
25 | 19 | 031 | end of medium | |
26 | 1A | 032 | substitute | |
27 | 1B | 033 | escape | |
28 | 1C | 034 | file separator | |
29 | 1D | 035 | group separator | |
30 | 1E | 036 | record separator | |
31 | 1F | 037 | unit separator | |
32 | 20 | 040 | space | |
33 | 21 | 041 | ! | |
34 | 22 | 042 | " | |
35 | 23 | 043 | # | |
36 | 24 | 044 | $ | |
37 | 25 | 045 | % | |
38 | 26 | 046 | & | |
39 | 27 | 047 | ' | |
40 | 28 | 050 | ( | |
41 | 29 | 051 | ) | |
42 | 2A | 052 | * | |
43 | 2B | 053 | + | |
44 | 2C | 054 | , | |
45 | 2D | 055 | - | |
46 | 2E | 056 | . | |
47 | 2F | 057 | / | |
48 | 30 | 060 | 0 | |
49 | 31 | 061 | 1 | |
50 | 32 | 062 | 2 | |
51 | 33 | 063 | 3 | |
52 | 34 | 064 | 4 | |
53 | 35 | 065 | 5 | |
54 | 36 | 066 | 6 | |
55 | 37 | 067 | 7 | |
56 | 38 | 070 | 8 | |
57 | 39 | 071 | 9 | |
58 | 3A | 072 | : | |
59 | 3B | 073 | ; | |
60 | 3C | 074 | < | |
61 | 3D | 075 | = | |
62 | 3E | 076 | > | |
63 | 3F | 077 | ? | |
64 | 40 | 100 | @ | |
65 | 41 | 101 | A | |
66 | 42 | 102 | B | |
67 | 43 | 103 | C | |
68 | 44 | 104 | D | |
69 | 45 | 105 | E | |
70 | 46 | 106 | F | |
71 | 47 | 107 | G | |
72 | 48 | 110 | H | |
73 | 49 | 111 | I | |
74 | 4A | 112 | J | |
75 | 4B | 113 | K | |
76 | 4C | 114 | L | |
77 | 4D | 115 | M | |
78 | 4E | 116 | N | |
79 | 4F | 117 | O | |
80 | 50 | 120 | P | |
81 | 51 | 121 | Q | |
82 | 52 | 122 | R | |
83 | 53 | 123 | S | |
84 | 54 | 124 | T | |
85 | 55 | 125 | U | |
86 | 56 | 126 | V | |
87 | 57 | 127 | W | |
88 | 58 | 130 | X | |
89 | 59 | 131 | Y | |
90 | 5A | 132 | Z | |
91 | 5B | 133 | [ | |
92 | 5C | 134 | \ | |
93 | 5D | 135 | ] | |
94 | 5E | 136 | ^ | |
95 | 5F | 137 | _ | |
96 | 60 | 140 | ` | |
97 | 61 | 141 | a | |
98 | 62 | 142 | b | |
99 | 63 | 143 | c | |
100 | 64 | 144 | d | |
101 | 65 | 145 | e | |
102 | 66 | 146 | f | |
103 | 67 | 147 | g | |
104 | 68 | 150 | h | |
105 | 69 | 151 | i | |
106 | 6A | 152 | j | |
107 | 6B | 153 | k | |
108 | 6C | 154 | l | |
109 | 6D | 155 | m | |
110 | 6E | 156 | n | |
111 | 6F | 157 | o | |
112 | 70 | 160 | p | |
113 | 71 | 161 | q | |
114 | 72 | 162 | r | |
115 | 73 | 163 | s | |
116 | 74 | 164 | t | |
117 | 75 | 165 | u | |
118 | 76 | 166 | v | |
119 | 77 | 167 | w | |
120 | 78 | 170 | x | |
121 | 79 | 171 | y | |
122 | 7A | 172 | z | |
123 | 7B | 173 | { | |
124 | 7C | 174 | | | |
125 | 7D | 175 | } | |
126 | 7E | 176 | ~ | |
127 | 7F | 177 | DEL |
Friday, 23 September 2016
ASCII Character Codes
Matrix Transpose
/* Transpose the matrix */
#include<stdio.h>
int main()
{
int a[4][4],i,j,b;
for(i=0;i<4;i++)
{
printf("\nEnter elements of %d row of Matrix: ",i+1);
for(j=0;j<4;j++)
scanf("%d",&a[i][j]);
}
for(i=0;i<4;i++)
{
for(j=i+1;j<4;j++)
{
b=a[i][j];
a[i][j]=a[j][i];
a[j][i]=b;
}
}
printf("\nTransposed Matrix:\n\n");
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
printf("%4d",a[i][j]);
printf("\n");
}
return 0;
}
#include<stdio.h>
int main()
{
int a[4][4],i,j,b;
for(i=0;i<4;i++)
{
printf("\nEnter elements of %d row of Matrix: ",i+1);
for(j=0;j<4;j++)
scanf("%d",&a[i][j]);
}
for(i=0;i<4;i++)
{
for(j=i+1;j<4;j++)
{
b=a[i][j];
a[i][j]=a[j][i];
a[j][i]=b;
}
}
printf("\nTransposed Matrix:\n\n");
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
printf("%4d",a[i][j]);
printf("\n");
}
return 0;
}
Sum of two Matrix
/* Sum of two Matrix */
#include<stdio.h>
int main()
{
int a[5][5],b[5][5],c[5][5];
int i,j;
for(i=0;i<5;i++)
{
printf("\nEnter elements of %d row of first Matrix: ",i+1);
for(j=0;j<5;j++)
scanf("%d",&a[i][j]);
}
for(i=0;i<5;i++)
{
printf("\nEnter elements of %d row of 2nd Matrix: ",i+1);
for(j=0;j<5;j++)
scanf("%d",&b[i][j]);
}
printf("\nSum of Matrix:\n\n");
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
c[i][j]=a[i][j]+b[i][j];
printf("%3d ",c[i][j]);
}
printf("\n");
}
return 0;
}
#include<stdio.h>
int main()
{
int a[5][5],b[5][5],c[5][5];
int i,j;
for(i=0;i<5;i++)
{
printf("\nEnter elements of %d row of first Matrix: ",i+1);
for(j=0;j<5;j++)
scanf("%d",&a[i][j]);
}
for(i=0;i<5;i++)
{
printf("\nEnter elements of %d row of 2nd Matrix: ",i+1);
for(j=0;j<5;j++)
scanf("%d",&b[i][j]);
}
printf("\nSum of Matrix:\n\n");
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
c[i][j]=a[i][j]+b[i][j];
printf("%3d ",c[i][j]);
}
printf("\n");
}
return 0;
}
Matrix Multiplication
/* Matrix multiplication */
#include<stdio.h>
int main()
{
int arr1[3][3],arr2[3][3],arr3[3][3]={0},i,j,k;
printf("Type a matrix of 3 rows & 3 colomns :\n");
for(i=0;i<3;i++)
for(j=0;j<3;j++)
scanf("%d",&arr1[i][j]);
printf("Type another matrix of 3 rows & 3 colomns :\n");
for(i=0;i<3;i++)
for(j=0;j<3;j++)
scanf("%d",&arr2[i][j]);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
for(k=0;k<3;k++)
arr3[i][j]=arr3[i][j]+arr1[i][k]*arr2[k][j];
}
}
printf("\n\nOutput:\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%5d",arr3[i][j]);
printf("\n\n");
}
return 0;
}
#include<stdio.h>
int main()
{
int arr1[3][3],arr2[3][3],arr3[3][3]={0},i,j,k;
printf("Type a matrix of 3 rows & 3 colomns :\n");
for(i=0;i<3;i++)
for(j=0;j<3;j++)
scanf("%d",&arr1[i][j]);
printf("Type another matrix of 3 rows & 3 colomns :\n");
for(i=0;i<3;i++)
for(j=0;j<3;j++)
scanf("%d",&arr2[i][j]);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
for(k=0;k<3;k++)
arr3[i][j]=arr3[i][j]+arr1[i][k]*arr2[k][j];
}
}
printf("\n\nOutput:\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%5d",arr3[i][j]);
printf("\n\n");
}
return 0;
}
Sort array of 10 strings
/* Sort array of 10 strings. */
#include<string.h>
#include<stdio.h>
int main()
{
int i,j;
char str[10][10],temp[10];
printf("Type 10 names :\n");
for(i=0;i<10;i++)
{
// gets(str[i]);
// fgets is a better option over gets to read multiword string .
fgets(str[i], 10, stdin);
}
for(i=0;i<10;i++)
{
for(j=0;j<10-1-i;j++)
{
if(strcmpi(str[j],str[j+1])>0)
{
strcpy(temp,str[j]);
strcpy(str[j],str[j+1]);
strcpy(str[j+1],temp);
}
}
}
printf("\nSorted Names :\n");
for(i=0;i<10;i++)
puts(str[i]);
return 0;
}
Insertion Sort
/* Insertion Sort */
#include<stdio.h>
int main()
{
int arr[10],i,j,new;
printf("Please enter 10 values:\n");
for(i=0;i<10;i++)
scanf("%d",&arr[i]);
for(i=1;i<10;i++)
{
new=a[i];
for(j=i-1;j>=0&&new<a[j];j--)
{
a[j+1]=a[j];
}
a[j+1]=new;
}
printf("Sorted Array is:\n");
for(i=0;i<10;i++)
printf("%d\n",arr[i]);
return 0;
}
Selection Sort
/* Selection Sort */
#include<stdio.h>
int main()
{
int arr[10],i,j,k,t;
printf("Please enter 10 values:\n");
for(i=0;i<10;i++)
scanf("%d",&arr[i]);
for(i=0;i<10;i++)
{
k=i;
for(j=i;j<10;j++)
{
if(a[k]>a[j])
k=j;
}
if(k!=i)
{
t=a[k];
a[k]=a[i];
a[i]=t;
}
}
printf("Sorted Array is:\n");
for(i=0;i<10;i++)
printf("%d\n",arr[i]);
return 0;
}
Bubble Sort
/* Bubble Sort */
#include<stdio.h>
int main()
{
int arr[10],i,j,t;
printf("Please enter 10 values:\n");
for(i=0;i<10;i++)
scanf("%d",&arr[i]);
for(i=0;i<9;i++)
{
for(j=0;j<9-i;j++)
{
if (arr[j]>arr[j+1])
{
t=arr[j];
arr[j]=arr[j+1];
arr[j+1]=t;
}
}
}
printf("Sorted Array is:\n");
for(i=0;i<10;i++)
printf("%d\n",arr[i]);
return 0;
}
Binary Search
/* Binary Search */
#include<stdio.h>
int main()
{
int arr[10],i,max,min,mid,val,index;
printf("Please enter 10 values in ascending order:\n");
for(i=0;i<10;i++)
scanf("%d",&arr[i]);
printf("\nEnter a value to be searched: ");
scanf("%d",&val);
max=9;
min=0;
index=-1;
while(min<=max)
{
mid=(max+min)/2;
if(val==arr[mid])
{
index=mid;
break;
}
if(arr[mid]>val)
max=mid-1;
else
min=mid+1;
}
if(index>=0)
printf("Value found in Array at %d location",index);
else
printf("Value not found in Array");
return 0;
}
File Copy using command line arguments
/* File Copy using command line arguments */
#include<stdio.h>
int main(int argc,char *argv[])
{
FILE *fs,*ft;
int ch;
if(argc!=3)
{
printf("Invalide numbers of arguments.");
return 1;
}
fs=fopen(argv[1],"r");
if(fs==NULL)
{
printf("Can't find the source file.");
return 1;
}
ft=fopen(argv[2],"w");
if(ft==NULL)
{
printf("Can't open target file.");
fclose(fs);
return 1;
}
while(1)
{
ch=fgetc(fs);
if (feof(fs)) break;
fputc(ch,ft);
}
fclose(fs);
fclose(ft);
return 0;
}
File to upper case using command line arguments
/* File to upper case using command line arguments */
#include<stdio.h>
int main(int n,char *a[])
{
int c;
FILE *fr,*fw;
if(n!=3)
{
printf("Invalide numbers of arguments.");
return 1;
}
if((fr=fopen(a[1],"r"))==NULL)
{
printf("File can't be open.");
return 1;
}
if((fw=fopen(a[2],"r+"))==NULL)
{
printf("File can't be open.");
fclose(fr);
return 1;
}
while(1)
{
c=fgetc(fr);
if(feof(fr)) break;
c=~c;
fputc(c,fw);
}
fclose(fr);
fclose(fw);
return 0;
}
Count characters of file
/* Count characters of file */
#include<stdio.h>
int main()
{
FILE *fp;
char a[10];
long cnt=0;
int c;
printf("Type a file name : ");
gets(a);
if((fp=fopen(a,"r"))==NULL)
printf("File dosen't exist.");
else
{
while(1)
{
c=fgetc(fp);
if(feof(fp)) break;
cnt++;
}
printf("\nfile have %ld characters",cnt);
}
fclose(fp);
return 0;
}
Write to text file
/* Write to text file */
#include<stdio.h>
int main()
{
FILE *fp;
char mystr[100];
fp=fopen("mytext.txt","w");
if(fp==NULL)
{
puts("Some error occured.");
return 1;
}
printf("\nEnter some lines:\n");
while(strlen(gets(mystr))>0)
{
fputs(mystr,fp);
fputs("\n",fp);
}
fclose(fp);
return 0;
}
Read text file
/* Read text file */
#include<stdio.h>
int main()
{
FILE *fp;
int ch;
fp=fopen("myfile.txt","r");
if(fp==NULL)
{
printf("Can't find the source file.");
return 1;
}
while(1)
{
ch=fgetc(fp);
if(feof(fp)) break;
printf("%c",ch);
}
fclose(fp);
return 0;
}
Towers of Hanoi by recursion
/* Towers of Hanoi by recursion */
#include<stdio.h>
void toh(int,char,char,char);
int main()
{
int n=3;
toh(n,'A','B','C');
return 0;
}
void toh(int n,char a,char b,char c)
{
if(n==1)
printf("\nMoved from %c to %c",a,c);
else
{
toh(n-1,a,c,b);
toh(1,a,' ',c);
toh(n-1,b,a,c);
}
}
Binary by recursion
/* Binary by recursion */
#include<stdio.h>
void binary(long);
int main()
{
long n;
printf("Type a value : ");
scanf("%ld",&n);
binary(n);
return 0;
}
void binary(long n)
{
if(n>1)
binary(n/2);
printf("%ld",n%2);
}
GCD by Recursion
/* greatest common divisor by recursion */
#include<stdio.h>
int gcd(int,int);
int main()
{
int a,b;
printf("Type 2 values to find GCD :\n");
scanf("%d %d",&a,&b);
printf("GCD : %d",gcd(a,b));
return 0;
}
int gcd(int m,int n)
{
if(n>m) return gcd(n,m);
if(n==0) return m;
return gcd(n,m%n);
}
Sum of digit by Recursion
/* Sum of digit by recursion */
#include<stdio.h>
int sod(int);
int main()
{
int i;
printf(" Type any value : ");
scanf("%d",&i);
printf("Sum of digit : %d",sod(i));
return 0;
}
int sod(int n)
{
if(n<1)
return 0;
return(n%10+sod(n/10));
}
Reverse by Recursion
/* Reverse by Recursion */
#include<stdio.h>
int rev(int,int);
int main()
{
int a;
printf("Type a value : ");
scanf("%d",&a);
printf("Reverse: %d",rev(a,0));
return 0;
}
int rev(int i,int r)
{
if(i > 0)
return rev(i/10,(r*10)+(i%10));
return r;
}
Fibonacci by Recursion
/* Fibonacci by Recursion */
#include<stdio.h>
int fib(int);
int main()
{
printf("Type any value : ");
printf("\nNth value: %d",fib(getche()-'0'));
return 0;
}
int fib(int n)
{
if(n<=1)
return n;
return(fib(n-1)+fib(n-2));
}
Power by Recursion
/* Power by Recursion */
#include<stdio.h>
int pow(int,int);
int main()
{
int i,j;
printf("Type two values : \n");
scanf("%d %d",&i,&j);
printf("i pow j = %d",pow(i,j));
return 0;
}
int pow(int i,int j)
{
if(j==1)
return i;
return (i*pow(i,j-1));
}
Factorial by Recursion
/* Factorial by Recursion */
#include<stdio.h>
int fact(int);
int main()
{
int n;
printf("Type any value : ");
scanf("%d",&n);
n=fact(n);
printf("\nFactorial : %d ",n);
return 0;
}
int fact(int x)
{
if(x==1)
return(x);
else
x=x*fact(x-1);
}
Series Program : 1 3 8 15 27 50 92 169 311
1 3 8 15 27 50 92 169 311
void main()
{
int a=1, b=3, c=4, n=10, sum, i;
printf("%d %d ",a,b,c);
for(i=4; i<=n; i++)
{
sum = a+b+c;
printf("%d ",sum);
a = b;
b = c;
c = sum;
}
}
Series Program : 2 15 41 80 132 197 275 366 470 587
2 15 41 80 132 197 275 366 470 587
int main()
{
int a=2,i,n=10;
for(i=1;i<=n;i++)
{
printf("%d ",a);
a+=13*i;
}
return 0;
}
Series Program : 1 2 3 6 9 18 27 54...
1 2 3 6 9 18 27 54...
int main()
{
int a=1,b=2,i,n=10;
printf("%d %d ",a, b);
for(i=3;i<=n;i++)
{
if(i%2==1)
{
a=a*3;
printf("%d ",a);
}
else
{
b=b*3;
printf("%d ",b);
}
}
return 0;
}
Series Program : 1/2 - 2/3 + 3/4 - 4/5 + 5/6 - ...... n
1/2 - 2/3 + 3/4 - 4/5 + 5/6 - ...... n
int main()
{
double i, n,sum=0;
n=10;
for(i=1;i<=n;i++)
{
if ((int)i%2==1)
sum+=i/(i+1);
else
sum-=i/(i+1);
}
printf("Sum: %lf",sum);
return 0;
}
Series Program : [(1^1)/1] + [(2^2)/2] + [(3^3)/3] + [(4^4)/4] + [(5^5)/5] + ... + [(n^n)/n]
[(1^1)/1] + [(2^2)/2] + [(3^3)/3] + [(4^4)/4] + [(5^5)/5] + ... + [(n^n)/n]
long power(int a, int b)
{
long i, p=1;
for(i=1;i<=b;i++)
{
p=p*a;
}
return p;
}
int main()
{
long i,n;
double sum=0;
n=5;
for(i=1;i<=n;i++)
{
sum=sum+(power(i,i)/i);
}
printf("Sum: %lf",sum);
return 0;
}
Series Program : (1!/1) + (2!/2) + (3!/3) + (4!/4) + (5!/5) + ... + (n!/n)
(1!/1) + (2!/2) + (3!/3) + (4!/4) + (5!/5) + ... + (n!/n)
long fact(int n)
{
long i, f=1;
for(i=1;i<=n;i++)
{
f=f*i;
}
return f;
}
int main()
{
long i,n;
double sum=0;
n=5;
for(i=1;i<=n;i++)
{
sum=sum+(fact(i)/i);
}
printf("Sum: %lf",sum);
return 0;
}
Series Program : (1^1) + (2^2) + (3^3) + (4^4) + (5^5) + ... + (n^n)
(1^1) + (2^2) + (3^3) + (4^4) + (5^5) + ... + (n^n)
long power(int a, int b)
{
long i, p=1;
for(i=1;i<=b;i++)
{
p=p*a;
}
return p;
}
int main()
{
long i,n,sum=0;
n=5;
for(i=1;i<=n;i++)
{
sum=sum+power(i,i);
}
printf("Sum: %d",sum);
return 0;
}
Series Program : 1! + 2! + 3! + 4! + 5! + ... + n!
1! + 2! + 3! + 4! + 5! + ... + n!
long fact(int n)
{
long i, f=1;
for(i=1;i<=n;i++)
{
f=f*i;
}
return f;
}
int main()
{
long i,n,sum=0;
n=5;
for(i=1;i<=n;i++)
{
sum=sum+fact(i);
}
printf("Sum: %d",sum);
return 0;
}
Series Program : (1) + (1+2) + (1+2+3) + (1+2+3+4) + ... + (1+2+3+4+...+n)
(1) + (1+2) + (1+2+3) + (1+2+3+4) + ... + (1+2+3+4+...+n)
int main()
{
int i,j,n,sum=0;
n=10;
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
sum+=j;
}
}
printf("Sum: %d",sum);
return 0;
}
Series Program : (1*1) + (2*2) + (3*3) + (4*4) + (5*5) + ... + (n*n)
(1*1) + (2*2) + (3*3) + (4*4) + (5*5) + ... + (n*n)
int main()
{
int i,n,sum=0;
n=10;
for(i=1;i<=n;i++)
{
sum+=i*i;
}
printf("Sum: %d",sum);
return 0;
}
series program : 1 + 2 + 3 + 4 + 5 + ... + n
1 + 2 + 3 + 4 + 5 + ... + n
int main()
{
int i,n,sum=0;
n=10;
for(i=1;i<=n;i++)
{
sum+=i;
}
printf("Sum: %d",sum);
return 0;
}
Alphabet pattern : ABCDE ABCD ABC AB A
ABCDE
ABCD
ABC
AB
A
#include <stdio.h>
int main()
{
int i, j;
for(i=5;i>=1;i--)
{
for(j=1;j<=i;j++)
{
printf("%c",'A' + j-1);
}
printf("\n");
}
return 0;
}
Alphabet pattern : ABCDE BCDE CDE DE E
ABCDE
BCDE
CDE
DE
E
#include <stdio.h>
int main()
{
int i, j;
for(i=1;i<=5;i++)
{
for(j=i;j<=5;j++)
{
printf("%c", 'A'-1 + j);
}
printf("\n");
}
return 0;
}
Alphabet pattern : EDCBA DCBA CBA BA A
EDCBA
DCBA
CBA
BA
A
#include <stdio.h>
int main()
{
int i, j;
for(i=5;i>=1;i--)
{
for(j=i;j>=1;j--)
{
printf("%c",'A'-1 + j);
}
printf("\n");
}
return 0;
}
Alphabet pattern : EDCBA EDCB EDC ED E
EDCBA
EDCB
EDC
ED
E
#include <stdio.h>
int main()
{
int i, j;
for(i=1;i<=5;i++)
{
for(j=5;j>=i;j--)
{
printf("%c",'A'-1 + j);
}
printf("\n");
}
return 0;
}
Alphabet pattern : A BB CCC DDDD EEEEE
A
BB
CCC
DDDD
EEEEE
#include <stdio.h>
int main()
{
int i, j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("%c",'A'-1 + i);
}
printf("\n");
}
return 0;
}
Alphabet pattern : E DD CCC BBBB AAAAA
E
DD
CCC
BBBB
AAAAA
#include <stdio.h>
int main()
{
int i, j;
for(i=5;i>=1;i--)
{
for(j=5;j>=i;j--)
{
printf("%c",'A'-1 + i);
}
printf("\n");
}
return 0;
}
Alphabet pattern : EEEEE DDDD CCC BB A
EEEEE
DDDD
CCC
BB
A
#include <stdio.h>
int main()
{
int i, j;
for(i=5;i>=1;i--)
{
for(j=1;j<=i;j++)
{
printf("%c",'A'-1 + i);
}
printf("\n");
}
return 0;
}
Alphabet pattern : AAAAA BBBB CCC DD E
AAAAA
BBBB
CCC
DD
E
#include <stdio.h>
int main()
{
int i, j;
for(i=1;i<=5;i++)
{
for(j=5;j>=i;j--)
{
printf("%c",'A'-1 + i);
}
printf("\n");
}
return 0;
}
Alphabet pattern : A AB ABC ABCD ABCDE
A
AB
ABC
ABCD
ABCDE
#include <stdio.h>
int main()
{
int i, j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("%c",'A' + j-1);
}
printf("\n");
}
return 0;
}
Alphabet pattern : E DE CDE BCDE ABCDE
E
DE
CDE
BCDE
ABCDE
#include <stdio.h>
int main()
{
int i, j;
for(i=5;i>=1;i--)
{
for(j=i;j<=5;j++)
{
printf("%c",'A' + j-1);
}
printf("\n");
}
return 0;
}
Alphabet Pattern : A BA CBA DCBA EDCBA
A
BA
CBA
DCBA
EDCBA
#include <stdio.h>
int main()
{
int i, j;
for(i=1;i<=5;i++)
{
for(j=i;j>=1;j--)
{
printf("%c",'A' + j-1);
}
printf("\n");
}
return 0;
}
Alphabet Pattern E ED EDC EDCB EDCBA
E
ED
EDC
EDCB
EDCBA
#include <stdio.h>
int main()
{
int i, j;
for(i=5;i>=1;i--)
{
for(j=5;j>=i;j--)
{
printf("%c",'A' + j-1);
}
printf("\n");
}
return 0;
}
Subscribe to:
Posts (Atom)
Featured post
Will AI Replace Programmers? The Truth Behind the Hype in 2025
Exploring the Future of Coding: Will AI Take Over Software Development or Enhance It? Will AI Replace Programmers? The Truth Behind the Hyp...
-
1 23 456 78910 #include<stdio.h> int main() { int i,j,k; k=1; for(i=1;i<5;i++) { for(j=1;j<=i;j++) { printf("%d",k++);...
-
1 10 101 1010 10101 #include<stdio.h> int main() { int i,j,k; for(i=1;i<=5;i++) { for(j=1;j<=i;j++) { printf("%d",j%2)...
-
13579 3579 579 79 9 #include <stdio.h> int main() { int i,j; for(i=1;i<=9;i+=2) { for(j=i;j<=9;j+=2) { print...
-
12345 4321 123 21 1 int main() { int i,j,k; for(i=5;i>=1;i--) { if(i%2==1) k=1; else k=i; for(j=1;j<=i;j++) { printf("%d",k)...
-
1234567 12345 123 1 int main() { int i,j; for(i=7;i>=1;i-=2) { for(j=1;j<=i;j++) { printf("%d",j); } printf("\n");...