New to C, but I think the first 2 challenges are ok. I think the Dice would have been easier with functions but I haven't got there yet! Hopefully anyone struggling may be able to use something here or a anyone with tips on how I can improve on it would be awesome :)


CHALLENGE #1:

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

/*  BUCKY's PASSWORD CHALLENGE!  */
//  A program that checks for one uppercase letter, a number and a symbol to pass!



int main()
{
    //  i as a counter, password for input and validation for..well...Validation!!
    int i = 0;
    char password[20];
    int validation;


    //  Get users input...
    printf("Enter a password to continue: \n");
    scanf(" %s", password);


    //  Reset validation before loop...
    validation =0;


    //  Test for the 3 conditions...
    for(i=0; password != '\0'; i++)   {

                if(isalpha(password) ) {
                    if(isupper(password)) {
                        validation += 1;
                    }
                }else if (isdigit(password)) {
                        validation += 1;
                }else if (password == '$') {
                        validation += 1;
                }else{
                        validation += 1;            // Validation goes out of bounds and fails!
                }
    }

    //  You can use 'if else' or a switch statement here:)
    if (validation == 3)   {
        printf("Password accepted!");
    }else{
        printf("Invalid password!");
    }


    //  Alternatively (does the same thing!)

    /* switch(validation)  {
            case 3 :   printf("Password accepted!");
                       break;
            default:   printf("Invalid Password!");
    }  */

    return 0;
}



CHALLENGE #2:
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <time.h>


/*  Challenge Two:
    DiceRoll Game    */



int main()
{
    srand( time(NULL));

    char startGame;
    char userGuess;
    char playAgain;

    int roll = 0;
    int rollValue = 0;
    int rollTally = 0;
    int userTally = 0;
    int correctGuess = 0;


    //  Welcome (Start or exit?)...
        printf("WELCOME TO BUCKY's DICE GAME!!!\n\n");

        printf("Press Enter To roll 3 dice...\n");
        printf("(0 - To quit at anytime)\n");

        scanf("%c", &startGame);



    //  If user only pressed enter then begin the first roll...
    while(startGame == '\n') {

        for(roll = 1; roll <= 3; roll++)   {

            rollValue = ((rand()%6)+1 );
                printf("Roll Number %d revealed a %d \n", roll, rollValue );

                rollTally += rollValue;
        }

    //  Print out the total from the first round...
        printf("\nTHE TOTAL: %d\n\n", rollTally);


    //  Prompt user to guess next rounds total (higher, lower or same)...
        printf("Now guess if the next round will be (h)higher, (l)lower, or the (s)same? \n(h,l or s): ");
        scanf(" %c", &userGuess);

        printf("\n");


    //  Test if USER didnt decide to quit!
        if(userGuess == '0')    {
            startGame = '0';
            continue;
        }




    //  Lets roll again and add to userTally this time...
        for(roll = 1; roll <= 3; roll++)   {

            rollValue = ((rand()%6)+1 );
                printf("Roll Number %d revealed a %d \n", roll, rollValue );

                userTally += rollValue;
        }

    //  Print out the total from the guessing round...
        printf("\nLAST ROUND: %d\t THIS ROUND: %d\n", rollTally, userTally);




    //  Check if user guessed correctly, the display a message!
        if(userTally < rollTally && userGuess == 'l')    {
                correctGuess = 1;
            }else if(userTally > rollTally && userGuess == 'h')  {
                correctGuess = 2;
            }else if(userTally == rollTally && userGuess == 's')  {
                correctGuess = 3;
            }else{
                correctGuess = 0;
            }

        switch(correctGuess)    {
                case 1  : printf("\nWELL DONE! ****Lower was a correct guess****\n");
                          break;
                case 2  : printf("\nWELL DONE! ****Higher was a correct guess****\n");
                          break;
                case 3  : printf("\nWELL DONE! ****It was the same, wow****\n");
                          break;
                case 0  : printf("\nSORRY! Your guess was wrong!\n");
                          break;
        }


    //  Ask if user wants to play again?
        printf("\nPLAY AGAIN? (y/n) \n");
        scanf(" %c", &playAgain);

        if(isalpha(playAgain))    {
            if(playAgain == 'y') {
                printf("\n\n*******NEW GAME***********\n");
                printf("LET'S GO.... NEXT ROUND...\n\n");
                continue;
            }else{
                startGame = '0';
                continue;
            }
        }
    }

        printf("\nThank you for playing... Goodbye!\n\n");

    return 0;
}