0% found this document useful (0 votes)
7 views3 pages

C Programming Lab: Conditional Structures

Uploaded by

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

C Programming Lab: Conditional Structures

Uploaded by

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

Technological University of the Philippines

Computer Programming 1

Lab Activity using Conditional Structures

Problem# 1: Write a C program to find largest from three numbers given by user using
Nested if-else or if-else-if structure. (filename: Lastname_largest.c)

Sample Run:

---------------

Enter three numbers:

12↲

33↲

-17↲

Largest = 33

Problem #2: Write a C program to check whether a given character is letter ‘c’ or not.
(filename: Lastname_charc.c)

Sample Run 1:

-------------------

Enter any character: c↲

It is a letter c.

Run 2:

-------------------
Enter any character: m↲

It is not a letter c.

Problem#3: Write C program to print weekday based on given number using switch-case.

(filename: Lastname_weekday.c)

Sample Run 1:

------------------

Enter day number: 3↲

TUESDAY.

Sample Run 2:

------------------

Enter day number: -3↲

INVALID DAY.

Problem#4: Write C program to check whether the input character is a vowel or consonant
using any of the conditional structure. (filename: Lastname_vowcon.c)
Sample Run 1:

------------------

Enter day character: x↲

x is a consonant .

Sample Run 2:

------------------

Enter day character: E↲

E is a vowel .

Problem #5: Write a C program to input an integer from user. Check if the given integer is
negative, zero or positive. (filename: Lastname_negpos.c)

Sample Run 1:

------------------

Enter any number:-22 ↲

The number is Negative

Sample Run 2:

------------------

Enter any number:0 ↲

The number is Zero.

You might also like