The document outlines an assignment focused on conditional statements in C programming. It includes a series of programming tasks that require the user to implement various conditional checks and arithmetic operations based on user input. The tasks range from comparing numbers to evaluating mathematical expressions and checking properties of numbers and geometric figures.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
2 views
Assignment 7
The document outlines an assignment focused on conditional statements in C programming. It includes a series of programming tasks that require the user to implement various conditional checks and arithmetic operations based on user input. The tasks range from comparing numbers to evaluating mathematical expressions and checking properties of numbers and geometric figures.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3
ASSIGNMENT -7 (BASICS OF C PROGRAMMING)
Aim: Conditional Statements
Basic instructions: 1. Check every line of your program for semicolon (;) 2. Check printf for format specifier %d for integer numbers 3. Check scanf for %d and & sign before variable name
1. Enter two numbers from the keyboard. Write a program to
print the value of larger number. [Your program should output only one number which is greater among two. For example, if user enters 3 and 9, output should be: Larger number is 9]
2. Two numbers are input through the keyboard. Also, ask
the user to enter a choice. Write a program to do the following: I. Print sum of two numbers if user enters choice as 1. II. Print difference of two numbers if user enters choice as 2. III. Print product of two numbers if user enters choice as 3. IV. Print quotient if user enters choice as 4. V. Print NO OPERATION if user enters choice as 0 3. Ask the user to enter a value between 1 to 100. Write a program to print SUCCESS if the user enters any number between 50 to 100. Otherwise, it should print FAIL. 4. Ask the user to enter a value. Write a program to determine if the value is less than ten or greater than ten. Print messages accordingly. 5. Write a program to check whether a number is positive or negative. For example, if the user enters 8, it should print: Positive number. 6. Write a program to check whether an integer is odd or even. 7. Write a program to check whether a given number is divisible by 5 or not.
8. Write a program to check whether roots of a given
quadratic equation are real & distinct, real & equal or imaginary roots 9. Write a program which takes the cost price and selling price of a product from the user. Now calculate and print profit or loss percentage.
10. Write a program which takes the length of the sides
of a triangle as an input. Display whether the triangle is valid or not.