write a C program that declares an integer variable called "favorite_number". The program should then prompt the user to enter their favorite number, and use scanf to read the user's input into favorite_number. Finally, the program should print a message that includes the user's input.

Respuesta :

Answer:

// here is code in C.

// headers

#include <stdio.h>

// main function

int main(void) {

// variable declaration

int favorite_number;

 // ask user to enter favorite number

printf("enter your favorite number : ");

 // read the number

scanf("%d",&favorite_number);

 // print the message

printf("your favorite number is: %d",favorite_number);

return 0;

}

Explanation:

Declare a variable "favorite_number" of integer type.Ask user to enter favorite number and assign it to favorite_number.Then print the message which include the favorite number.

Output:

enter your favorite number : 77

your favorite number is: 77