HI. i am new in c programming.
Please help me making a program to print this
Code:0 101 21012 3210123 432101234
HI. i am new in c programming.
Please help me making a program to print this
Code:0 101 21012 3210123 432101234
Announcements - C Programming
I dun the furst rowe four ewe
Seriously, can you even manageCode:#include <stdio.h> int main ( ) { printf(" 0\n"); return 0; }
1
2
3
4
or even
1
12
123
1234
Either would be useful in showing us what you're actually capable of, as opposed to merely being lazy and hoping for someone to do all the work for you.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I hav to make a lot of programs so im just asking if anyone can help.
I don want you to write the full program. you can just provide me main loop statements if you hav time.
Sorry, but if you can do
1
12
123
1234
Then you already have in your own words - the main loop, and you're at least half-way to solving the problem.
And you've no idea how many people roll through here claiming to "have written code".
Post your latest best effort, and then we'll help.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I'm not that good but I wrote this real quick trying to figure out why mine is crashing
I didn't try to compile I just wrote this in the text boxCode:#include <stdio.h> #include <conio.h> int main() { int row=0, column=0, j=1, k=0; while (row<8){ k=row-8; while(k<8){ printf(" "); k++; } k=0; column=0; j=row+1; do{ if (column<(2*row+1)/2){ printf("%d", (j++)%10); }else{ printf("%d", (j--)%10); }column++; }while (column<row*2+1); printf("\n"); row++; } getch(); }
@Sorinx - it looks like a good effort, but please refrain from posting something close to a complete answer before the OP has even posted a line of code.
Otherwise, there is no learning (for the OP), with the possibly exception that it is sometimes possible to get someone else to do homework for you.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
The best way to handle these things is first, take a pen and paper, and BECOME the tip of the pen. Print out the digits slowly, and watch the patterns that develop. That will be the core of your logic. May take a few/several times, but those patterns will emerge.
In your program, start with a basic two for loops, one for the rows and an inner nested for loop, for the printing of each digit or space, in the columns of the print out.
If you get stuck, post what you have, and we'll make suggestions from there. It is UP TO YOU to post code, before we get into helping you with code. Sometimes we jump the gun, but that's the general rule.
Sorinx
thanks for the help.. only zeros r missing in the output but now i can make the program.. thanks..
Salem and Adak
thanks for the advice..