-1

trying to complete the Mario problem fast because I'm a little bit behind but cs50 sandbox like always has a problem with get int the error says: too few arguments to function call, at least argument 'format' must be specified

#include <cs50.h>
#include <stdio.h>

int main(void)
{
int n = 0;
do
{
int height;
//printf("Height: ");
 n= get_int();
}
while (n < 8 || n > 1);

for (int i=0; i<n; i++)
{
    for (int j=0; j<=n; j++)

    {
       if (i+j <(n=1)) 
     printf(" ");
        else
     printf("#");
    }
 printf("\n");


}

}

2 Answers2

0

You don't need cs50.h. Unless get_int is a requirement for your program. I hope this solution will help you with your studies.

EDIT: Just realized a Mario pyramid is different from a regular pyramid. My solution below is for a full pyramid. The question has already been asked and a solution can be found here.

#include <stdio.h>

int main(void)
{
    int n, i, j, k;

    printf("Number: ");
    scanf("%d", &n);

    for (i = 0; i < n; i++)
    {

        for (j = 0; j < n-i; j++)
        {
            printf(" ");
        }

        for (k =0; k <= i; k++)
        {
            printf("# ");
        }

        printf("\n");
    }

} 
Arthur Green
  • 136
  • 1
  • 10
0

It looks like you need to provide a string to get_int function, look here https://reference.cs50.net/cs50/get_int

so you should have something like

#include <cs50.h>
#include <stdio.h>

int main(void)
{
  int n = 0;
  do
  {
    int height;
    //printf("Height: ");
    n= get_int("Enter an int: ");
  }
  while (n < 8 || n > 1);