First of all Hello to all of you.
I am new to programming(about a week since I started learning it), a little young(12 years old) and totally interedtes in its thrill.
Second of all I would like to clear the superstition that students join this forum as they want you all GEEKS(love the word) to solve their home works. Well I also go to an institute known as Aptech however, whenver my faculty gives me homework. I do it myself. This is the first time I am asking you for help as my own teacher got a little confused in this sum.
Well I had to create a code to print the following output:
ABCDEFEDCBA
ABCDE EDCBA
ABCD DCBA
ABC CBA
AB BA
A A
Well after some tweaking I was able to do some of it(just got wrong and got it printed it like this):
ABCDEFEDCBA
ABCDE DCBA
ABCD CBA
ABC BA
AB A
A
I again did some tweaking and made something like this:
ABCDEFEDCBA
ABCDE EDCBA
ABCD DCBA
ABC CBA
AB BA
A
I dont know what the problem was. So I made an obvious type of tweaking and I got my output. I am thinking is my code too complicated or obvious. Here is my code. Would you all GEEKS help me:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
int main()
{
int i, j, k, n, x, y, l;
y = 69;
l = 0;
for (i = 1; i <=6; i++)
{
for (j = 65; j <=71 - i; j++)
{
printf("%c", j);
}
for (k = 1; k < i; k++)
{
printf(" ");
}
for (n = 1; n < i - 1; n++)
{
printf(" ");
}
for (x = 70-i; x >= 65; x--)
{
if (i == l && x == y)
{
printf("%c", y + 1);
}
printf("%c", x);
if ( i == 1)
{
l = 1;
}
}
if (i==6)
{
printf("%c", 65);
}
y--;
l++;
printf("\n");
}
getch();
}
P.S. Did I explain my qeustion correctly, or was I too confusing.