About Me

My photo
Vijayapur, Karnataka, India
I am interested in Teaching.

Tuesday 15 October 2019

Assignment 2: I Sem. G Division Subject: C for Problem Solving

1. Discuss the following decision making statements with syntax, flowchart and examples.

simple if

if else

nested if

else if ladder (cascaded if)

switch

Write C programs for following.

1. To find largest of 2 numbers.
2. To find largest of 3 numbers.
3. To check, whether the year is leap year not.
4. To check, whether the number is even or odd number.
5. To display Grades as per percentage of marks scored. (Refer following Table)
       Percentage      Grades
       90 to 100           O     
       80 to 89             S
       70 to 79             A
       60 to 69             B
       50 to 59             C
       45 to 49             D
       40 to 44             E
       0 to 39               F

6. To provide menu options using switch to find area of circle, area of rectangle and area of triangle to work according to users choice.




2.  Discuss the following with syntax, flowchart and examples.

while

do while

for

Write C programs for following.

To find factorial of n using while
To find factorial of n using do while
To find factorial of n using for

To find sum and average of 1 to 10 number using while.
To find sum and average of 1 to 10 number using do while
To find sum and average of 1 to 10 number using for

To print first N fibonacci numbers.


3. Explain following with syntax and examples.

break
continue
goto

4. Write differences between while and do while

5. Write differences between break and continue.

6. Write C program to check, entered number is PRIME or NOT PRIME.











No comments:

GCD of two numbers and its application...

The greatest common divisor (gcd) of two numbers is the largest positive integer that divides both numbers without leaving a remainder. The ...