'C Programming, scanf() function output [closed]

When I run the program on a Cygwin terminal, I am not able to achieve the following output:

38 $92360.88 llama

Notepad++ Cygwin Terminal Program Execution

// input.c -- when to use &
#include <stdio.h>
int main(void)
{
    int age;            // variable
    float assets;       // variable
    char pet[30];       // string
    
    printf("Enter your age, assets, and favorite pet.\n");
    scanf("%d %f", &age, &assets);      // use & here
    scanf("%s", pet);                   // no & for char array
    printf("%d $%.2f %s\n", age, assets, pet);
    
    return 0;
}

I am not sure what the most effective way to include my code is here without it looking a little choppy. My apologies in advance.

Thank you Brendan



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source