Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Fix code C only #include int main() { int i; double d; char ch; char s[100]; printf(Enter integer:); scanf(%d,&i); printf(Enter double:); scanf(%lf,&d); printf(Enter character:); scanf(%c,&ch);

Fix code C only

#include

int main()
{
int i;
double d;
char ch;
char s[100];

printf("Enter integer:");
scanf("%d",&i);

printf("Enter double:");
scanf("%lf",&d);

printf("Enter character:");
scanf("%c",&ch);
scanf("%c",&ch);

printf("Enter string:");
scanf("%s",s);

printf("%d %.2lf %c %s",i,d,ch,s);
//printf("%s %c %.2lf %d",s,ch,d,i);
printf("%.2lf cast to an integer is%d",d,(int)d);

return 0;
}

Error showing

99

3.77

z

Howdy

Your output starts with

Enter integer:

Enter double:

Enter character:

Enter string:

99 3.77 z Howdy

3.77 cast to an integer is 3

Expected output starts with

Enter integer:

Enter double:

Enter character:

Enter string:

99 3.770000 z Howdy

Howdy z 3.770000 99

3.770000 cast to an integer is 3

0 / 1

Step by Step Solution

3.40 Rating (163 Votes )

There are 3 Steps involved in it

Step: 1

include int main declare variables int i double d char ch char s100 read an i... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

An Introduction to Programming with C++

Authors: Diane Zak

8th edition

978-1285860114

More Books

Students also viewed these Programming questions