Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.1 For the program given below, compile, debug (find and fix any syntax errors), and execute the program and fix any semantic errors, for example,

1.1 For the program given below, compile, debug (find and fix any syntax errors), and execute the program and fix any semantic errors, for example, by adding "break" statements, change variable type so that floating point type of values can be stored and printed, and by proper initialization, if any. The code is supposed to perform one of the operations in each switch case. Submit the corrected program.

image text in transcribed

image text in transcribed

Output should be:

image text in transcribed

/This C program demonstrates the switch statement without using breaks. /* The program is tested with GCC and MS Visual C++ platform #include void main() int date29; int year; int month; int time; // For example: 10.45 So 2 digits for hours, 2 digit for minutes char ch; printf("ch = %c ", ch); switch (ch) case d': printf( "Date : %d ", date); case y: printf("Year : %d ", year) ; case sn': printf( "Month : %d ", month); case : printf( "Time : %d ", time); default: printf("invalid operator "); printf("ch = %c ", ch); switch (ch) case d': printf("Date : %d ", date); case y: printf( "Year : %d ", year) ; case "m': printf( "Month : %d ", month

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

The Database Experts Guide To SQL

Authors: Frank Lusardi

1st Edition

0070390029, 978-0070390027

More Books

Students also viewed these Databases questions