2nd Nov 2020, 8:28 PM
Adriana Garcia
Adriana Garcia - avatar
34 Antworten
+ 10
You're not using a condition after 'if'in line 20.
2nd Nov 2020, 11:44 PM
Sonic
Sonic - avatar
+ 7
Adriana Garcia in your code //you have error in this code, which i soecified 8n comments ,read it and make correct else { printf (" "); if { //incomplete statement for (i=0;n; n){ //loop has no exit condition for (j=i;j=n-1; j--) //wr9ng condition here printf ("*"); } } } else { //this is wrong brace match for if statement printf (""); //empty pr8nt statement,why this ? } }
2nd Nov 2020, 11:23 PM
Jayakrishna 🇮🇳
+ 6
The requirements are a little short on detail. What phase - Full Moon, Half, Crescent? How big? Here is a small Full Moon: puts("*"); The easiest solution is to draw a New Moon: puts(""); Does it necessarily need to be generated by algorithm, or may it be a simple set of manually-constructed strings?
2nd Nov 2020, 9:19 PM
Brian
Brian - avatar
+ 4
What's your doubt or problem? What are you trying..?
2nd Nov 2020, 8:45 PM
Jayakrishna 🇮🇳
+ 4
#include <stdio.h> int main() { int n, x=0; printf ("Size of the moon?\n "); scanf ("%d", &n); if (n<= 5) printf ("no moon"); else { /* Just try it first like in loop from i=0 to n For j=i to 0 and for j=n-I reoeat printing * I times, else print space Increment I, decrement n */ if(n%2!=0) n++; //this is because if odd numbers it may lead wrong, //so that why here adding 1 so it becomes even for (int i=0; i<n/2-1; i++) { for(int j=0; j<=n; j++) { if((j>=x && j<=i+x ) || (j>=n-x && j<=n+x)) printf(" *"); else printf(" "); } x++; //this is for in next we add only x stars at begin and end printf("\n"); } } return 0; }
2nd Nov 2020, 11:17 PM
Jayakrishna 🇮🇳
+ 3
Show the how it look like..? For graphic content, here it not support. You can try a simple patterns..
2nd Nov 2020, 8:50 PM
Jayakrishna 🇮🇳
+ 3
It is not possible here (without graphics) to print a exact round. But you can try to print '0'. Zero or a half moon.. Is that what you need? If I find what you trying then I can try to suggest..!
2nd Nov 2020, 9:07 PM
Jayakrishna 🇮🇳
+ 3
* * * * * * * * * Is this OK.?
2nd Nov 2020, 9:33 PM
Jayakrishna 🇮🇳
+ 3
OK. First find required output.. The console is a rectangular matrix type plot so without graphic you can only get only similar but rectangular type output.. And above that is like a big curve inside a small curve ((. (the crescent's upper and lower, but can't fill between) ((. the half moon is easy one..
2nd Nov 2020, 9:42 PM
Jayakrishna 🇮🇳
+ 3
okeyy
2nd Nov 2020, 10:31 PM
Adriana Garcia
Adriana Garcia - avatar
+ 3
Just try it first like in loop from i=0 to n For j=i to 0 and for j=n-I reoeat printing * I times, else print space Increment I, decrement n
2nd Nov 2020, 10:45 PM
Jayakrishna 🇮🇳
+ 3
Adriana Garcia you can't just write stuff and expect a moon to appear. You need to tell to the machine exactly what to do, and if you miss a single semicolon the program wouldn't work. It seems you are having troubles using loops. You are a human, I know you can do it: Google "for loop c" and read informations until you know all you need to know. Then make a serious attempt and if you are still having troubles and can't figure out why your program doesn't act as you wish, we will be glad to help you.
2nd Nov 2020, 11:22 PM
Davide
Davide - avatar
+ 3
Rewrite with while loop... 🤔
3rd Nov 2020, 5:11 PM
Sanjay Kamath
Sanjay Kamath - avatar
+ 2
yo draw the moon
2nd Nov 2020, 8:45 PM
Adriana Garcia
Adriana Garcia - avatar
+ 2
but dont know how
2nd Nov 2020, 8:46 PM
Adriana Garcia
Adriana Garcia - avatar
+ 2
i do not know how to draw the moon
2nd Nov 2020, 9:01 PM
Adriana Garcia
Adriana Garcia - avatar
+ 2
any ideas
2nd Nov 2020, 9:01 PM
Adriana Garcia
Adriana Garcia - avatar
+ 2
I know it is with for but i do not know how to write it
2nd Nov 2020, 9:02 PM
Adriana Garcia
Adriana Garcia - avatar
+ 2
it has to be crescent, still not half moon
2nd Nov 2020, 9:22 PM
Adriana Garcia
Adriana Garcia - avatar
+ 2
the size depende on the answer of the question the person types on the computer
2nd Nov 2020, 9:22 PM
Adriana Garcia
Adriana Garcia - avatar