1. Engineering
  2. Computer Science
  3. how would i modify the example so that it prints...

Question: how would i modify the example so that it prints...

Question details

How would i modify the example so that it
prints both of the variables using an int, a
character, and a float conversion specifier?

/* FILE: scan.c */
/*
Illustration of scanf( ).
*/

#include <stdio.h>

int main( )
{
int x;
float y;

printf("x = %d\n", x);
printf("y = %f\n", y);
printf("Enter an integer value for x: ");
scanf("%d", &x);
printf("Enter a floating-point value for y: ");
scanf("%f", &y);
printf("x = %d\n", x);
printf("y = %f\n", y);

return 0;
}

// Language is in C.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution