Skip to main content
3 of 5
added 61 characters in body

pset 1 help please

I am having trouble with problem set 1 and could use some help please!

Specifically, I am having problems generating the blocks in a pyramid. I have watched the walk through but am having trouble translating my ideas to code.

I understand that I need to print x number of spaces based on the user input but cannot figure out how to get x spaces to print. Can someone please help!

Is it ok that I paste my code in here?

Edit:

here is my code thus far thanks for your help!!

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

int main (void)

{

//asks user for the number of blocks printf("Please specify the number of blocks to be printed\n");

//declares a variable t to store the users input (number of blocks) int t;

//retrieve block number from user do { t = GetInt(); } while (t > 23 && t < 0)

//confirms to the user that the input has been accepted

      if (t < 23 && t > 0)
        {
             printf("Thank you %i blocks with be generated, t"); //error message here "error: more '%' conversions than data arguments" need help with this please 
             printf("\n");
        }

//pyramid generation (my hashes always come out in a straight line one space apart) for (int i = 0; i < t, i++) { printf("%c, t"); //(How do I represent x number of spaces that corresponds to the t variable that is based on user input?? printf("#"); printf("\n"); }

}

Other issues: any input is accepted even if it is above 23 or below 0 I am not sure what is wrong with my do while loop at the beginning

I know there is a lot here but if someone could spare a few minutes to help me out it would be greatly appreciated and I will be happy to do the same once I know what I am doing!

Thank you so much!

Thomas