Question: PLEASE READ THE STATEMENT PROBLEM. THE C PROGRAM BELOW IS SUPPOSE TO GUIDE US TO THE OUTCOME PROGRAM BELOW. HOWEVER I CANNOT COME OUT WITH

PLEASE READ THE STATEMENT PROBLEM. THE C PROGRAM BELOW IS SUPPOSE TO GUIDE US TO THE OUTCOME PROGRAM BELOW. HOWEVER I CANNOT COME OUT WITH THE SAME OUTCOME, PLEASE HELP. ALSO PLEASE THE PROFESSOR WANTS THE PROGRAM IN C, NOT C++

Problem Statement: Write a C program that shows the use of printf() and scanf() functions; use for input of three character variables, one integer variable, one decimal number input, and one long decimal number.

C-Program:

/* Program to show USE of printf and scanf functions */

#include

#include

int main()

{

/* define variables c1, c2, c3 with type 'char' */

char c1, c2, c3;

/* define variable i with 'int' type */

int i;

/* define variable x with 'float' type */

float x;

/* define variable y with 'double' type */

double y;

/* USE printf to request user to to ENTER 3 characters, one integer, one decimal number and one double */

printf(" %s %s","Input Three Characters, ","an integer, a decimal number, and a double ");

/* Use scanf to input 3 characters in char variables 'c1', 'c2', 'c3' */

/* Use scanf to input next an integer number in int variable 'i' */

/* Use scanf to input next a decimal number in float variable 'x' */

/* Use scanf to input next a double number in double variable 'y' */

scanf("%c%c%c",&c1,&c2,&c3);

scanf("%d",&i);

scanf("%f",&x);

scanf("%lf",&y);

/* Print out the variable values entered y the user */

printf(" Here is the data that you typed in: ");

printf("c1 = %c, c2 = %c, c3 = %c, i = %d, x = %17e, y = %17e ",c1, c2, c3, i, x, y);

return 0;

}

Output of this Program

(Result of this program to input and print 3 char variables, one int, one float and one double);

Input Three Characters,

an integer, a decimal number, and a double

ABC 3 55 77.7

Here is the data that you typed in:

c1 = A, c2 = B, c3 = C, i = 3, x = 5.500000e+001, y = 7.770000e+001

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!