0% found this document useful (0 votes)
3 views1 page

C Programming Task Examples

Uploaded by

rokayaabi123
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

C Programming Task Examples

Uploaded by

rokayaabi123
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Q.

1 Simple Calculator
Create a C program that implements a simple calculator. The program should take two
numbers and an operator (+, -, *, /) as input. Use a switch statement to perform
the operation and display the result. Handle division by zero by printing "Error:
Division by zero" when the operator is / and the second number is 0.

Q.2 Day Presenter


Create a C program that uses a switch statement to print the name of the day
corresponding to numbers 1 through 7, and outputs "Invalid day entry" for numbers 0
or greater than 7".

Q.3 (While Loop & Do While Loop)


Write a C program that calculates the sum of natural numbers from 1 to a given
input number n (input given by User).

Q.4 (For Loop)


Write a C program that generates and prints the multiplication table for a input
number n given by user.

You might also like