Section Three Exercises
Write a program
- 
    
Write a program to calculates the volume of a sphere.
Expected Output:
Input the radius of the sphere : 5 The volume of sphere : 523.598816. - 
    
Write a program to prints the perimeter of a rectangle to take its height and width as input.
Expected Output:
Input the height of the Rectangle : 5 Input the width of the Rectangle : 7 Perimeter of the Rectangle is : 24.00 - 
    
Write a program to converts kilometers per hour to miles per hour.
Expected Output:
Input kms per hour : 15 Miles per hour : 9.320568 - 
    
John bought a bicycle for Rs 350 and sold to a buyer for Rs 380. Did he make profit or loss by selling the bicycle?
Write a program to calculate the profit or loss and also find the profit or loss percentage.
 - 
    
Number inspector program.
Write a program to accept a number from keyboard, and check whether it is
- even or odd
 - prime or non-prime
 - divisible by 3
 
Expected Output:
Enter the number: 15 '15' is odd number. '15' is non-prime number. '15' is divisible by 3. - 
    
Write a program to accept a year as an input and determine whether it is a leap year or not.
Use the following logic:
Leap Year:
- If a year is divisible by 4, 100 and 400 then it is a leap year.
 - If a year is divisible by 4 but not divisible by 100 then it is a leap year
 
Not a Leap Year:
- If a year is not divisible by 4 then it is not a leap year
 - If a year is divisible by 4 and 100 but not divisible by 400 then it is not a leap year
 
 - 
    
Accept the ages of foo, bar, and baz from keyboard and write a program to determine the youngest and eldest among three.
 
Find output of program
- 
    
Behavior of
ifand Garbage value#include <stdio.h> int main() { int a = 300, b, c; if (a >= 400) b = 300; c = 200; printf("\n%d%d", b, c); return 0; } - 
    
Behavior of
if#include <stdio.h> int main() { int a = 10, b = 20; if (a == b); printf("\n%d%d", a, b); return 0; }NOTE: Try removing
;in theifstatement. - 
    
Behavior of
if...else#include <stdio.h> int main() { int a = 10, b = 20; if (a == 10) printf("\n%d", a); else; printf("\n%d", b); return 0; }NOTE: Understand why
20. 
    
    
  
  
  
  
  
  
  
    
Help me to improve BRG Trainings.