You are on page 1of 19

ASSIGNMENT

1> write a c program to take inputs from the user and add
those two numbers.

~ C code:

~ Output:

~ Explanation:
2> write a c program to take inputs from the user and
subtract those four numbers.

~ C code:

~ Output:

~ Explanation:
3> write a c program to take one input from the user and
Divide that number by zero.

~ C code:

~ Output:

~ Explanation:
4> write a c program to take inputs from the user and
multiply those four numbers.

~ C code:

~Output:

~ Explanation:
5> write a c program to solve the given equation: a+a-
b*c/d*e.

a=10,b=15,c=15,d=20,e=30

add parenthesis to change the order of operation so that


the output will be -90.

~ C code:

~ Output:

~ Explanation:
6> write a c program for company profit, take the company's
revenue and profit in percentages from the user.

~ C code:

~ Output:

~ Explanation:
7> write a c program that prints even numbers using a FOR
loop, ranging from 31 to 81.

~ C code:

~ Output:
~ Explanation:

8> write a c program that checks if a triangle is equilateral,


isosceles, or scalene. The user will be prompted for the
triangle sides.

Hint:
An equilateral triangle is one in which all three sides are the same
length.

An isosceles triangle is a triangle that has two equal sides.

A scalene triangle is a triangle that has three unequal sides.

~ C code:
~ Output-1:

~ Output-2:

~ Output-3:

~ Explanation for output-1:

~ Explanation for output-2:

~ Explanation for output-3:


9> Write a c program to check whether a year is a leap year
or not.

~ C code:

~ Output-1:

~ Output-2:
~ Explanation for output-1:

~ Explanation for output-2:


11> Write a c program to print the Fibonacci series using the
FOR loop(take input from the user).

~ C code:

~ Output:

~ Explanation:
12> Write a c program to print a Multiplication table using
FOR loop.

~ C code:

~ Output:

~ Explanation:
13> Write a c program to print the descent order among the
three values.

~ C code:
~ Output-1:

~ Output-2:

~ Output-3:

~ Explanation for output-1:

~ Explanation for output-2:


~ Explanation for output-3:
14> Write a c program to create a Simple Calculator using a
switch case.

~ C code:

~ Output-1:
~ Output-2:

~ Output-3:

~ Output-4:

~ Explanation for output-1:

~ Explanation for output-2:

~ Explanation for output-3:

~ Explanation for output-4:


15> C program to make a pyramid.

~ Output:

~Explanation for the space:

~ Explanation for the (*) star:

You might also like