Skip to content

pranavkanth/Learning-Codes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 

Repository files navigation

List of programs

  1. Calculate the salary of an employee who works on an hourly basis. The formula to be used is Salary = Hours worked * Pay rate.

  2. Write a Problem Analysis Chart (PAC) to convert the length in inches to centimeters where 1 inch = 2.54cm.

  3. Write a Problem Analysis Chart (PAC) to find an area of a circle where area = pi * radius * radius.

  4. Write a Problem Analysis Chart (PAC) to find the sum of two numbers.

  5. Write a program to calculate simple interest for a set of values representing principle, number of years, and rate of interest. The formula for computing simple interest is si = p * n* r / 100.

  6. Ramesh's basic salary is input through the keyboard. His dearness allowance is 40% of his basic salary and his house rent allowance is 20% of his basic salary. Write a program to calculate his gross salary.

  7. Temperature of a city in Fahrenheit is input through the keyboard. Write a program to convert it into Centigrade.

  8. Write a program to calculate the area and circumference of a circle.

  9. The distance between two cities (in km) is input through the keyboard. Write a program to convert and print this distance in meters, feet, inches, and centimeters.

  10. The length and breadth of a rectangle and the radius of a circle are input through the keyboard. Write a program to calculate the area and perimeter of the rectangle and the area and circumference of the circle.

  11. If a five-digit number is input through the keyboard, write a program to calculate the sum of its digits.

  12. If a five-digit number is input through the keyboard, write a program to reverse the number.

  13. Two numbers are input through the keyboard into two memory locations C and D. Write a program to interchange the contents of C and D.

  14. If a four-digit number is input through the keyboard, write a program to obtain the sum of the first and last digits of this number.

  15. If the total selling price of 15 items and the total profit earned on them is input through the keyboard, write a program to find the cost price of one item.

  16. While purchasing certain items, a discount of 10% is offered if the quantity purchased is more than 1000. If quantity and price per item are input through the keyboard, write a program to calculate the total expenses.

  17. In a company an employee is paid as under:

    • If his basic salary is less than Rs. 1500, then HRA = 10% of basic salary and DA= 90% of basic salary.
    • If his salary is either equal to or above Rs. 1500, then HRA = Rs. 500, and DA = 98% of his basic salary.

    If the employee's salary is input through the keyboard write a program to find his gross salary.

  18. The marks obtained by a student in 5 different subjects are input through the keyboard. The student gets a division as per the following rules:

    • Percentage above or equal to 60 First division
    • Percentage between 50 and 59 Second division
    • Percentage between 40 and 49 Third division
    • Percentage less than 40 - Fail

    Write a program to calculate the division obtained by the student.

  19. Write a program to calculate the salary as per the following table:

    Gender Years of service Qualifications Salary
    Male >= 10 Post-Graduate 15000
    >= 10 Graduate 10000
    < 10 Post-Graduate 10000
    < 10 Graduate 7000
    Female >= 10 Post-Graduate 12000
    >= 10 Graduate 9000
    < 10 Post-Graduate 10000
    < 10 Graduate 6000
  20. Any character is entered through the keyboard, write a program to determine whether the character entered is a capital letter, a small case letter, a digit, or a special symbol. The following table shows the range of ASCII values for various characters:

    Characters ASCII Values
    A-Z 65-90
    a-z 97-122
    0-9 48-57
    special symbols 0-47
    58-64
    91-96
    123-127
  21. An Insurance company follows the following rules to calculate the premium.

    1. If a person's health is excellent and the person is between 25 and 35 years of age and lives in a city and is a male then the premium is Rs. 4 per thousand and his policy amount cannot exceed Rs. 2 lakhs.
    2. If a person satisfies all the above conditions except that the sex is female then the premium is Rs. 3 per thousand and her policy amount cannot exceed Rs. 1 lakh.
    3. If a person's health is poor and the person is between 25 and 35 years of age and lives in a village and is a male then the premium is Rs. 6 per thousand and his policy cannot exceed Rs. 10,000.
    4. In all other cases the person is not insured.

    Write a program to output whether the person should be insured or not, his/her premium rate, and the maximum amount for which he/she can be insured.

  22. If the ages of Ram, Shyam, and Ajay are input through the keyboard, write a program to determine the youngest of the three.

  23. A certain grade of steel is graded according to the following conditions:

    1. Hardness must be greater than 50
    2. Carbon content must be less than 0.7
    3. Tensile strength must be greater than 5600

    The grades are as follows:

    • Grade is 10 if all three conditions are met Grade is 9 if conditions 1 and 2 are met
    • Grade is 8 if conditions 2 and 3 are met
    • Grade is 7 if conditions 1 and 3 are met
    • Grade is 6 if only one condition is met
    • Grade is 5 if none of the conditions are met

    Write a program, which will require the user to give values of hardness, carbon content, and tensile strength of the steel under consideration and output the grade of the steel.

  24. Using Conditional operators determine:

    1. Whether the character entered through the keyboard is an Upper case alphabet or not
    2. Whether the character entered through the keyboard is a special symbol or not
  25. Write a program using conditional operators to determine whether a year entered through the keyboard is a leap year or not

  26. Write a program to find the greatest of the three numbers entered through the keyboard. Use conditional Operators

  27. If the cost price and selling price of an item is input through the keyboard, write a program to determine whether the seller has made a profit or incurred a loss. Also, determine how much profit he made or the loss he incurred.

  28. Given the coordinates (x, y) of a center of a circle and its radius, write a program that will determine whether a point lies inside the circle, on the circle, or outside the circle.

  29. Write a program to find the factorial value of any number entered through the keyboard.

  30. Two numbers are entered through the keyboard. Write a program to find the value of one number raised to the power of another.

  31. Write a program to enter the numbers till the user wants and at the end, it should display the count of positive, negative, and zeros entered.

  32. Write a program to find the sum of the digits of a number.

  33. Write a program to find whether the given number is Armstrong or not.

  34. Write a program to generate the series

    *
    * *
    * * *
    * * * *
    * * * * *
    
  35. Write a program to generate the series

    1
    1 2
    1 2 3
    1 2 3 4
    1 2 3 4 5
    
  36. Write a program to generate the series

    1
    2 2
    3 3 3
    4 4 4 4
    5 5 5 5 5
    
  37. Write a program to generate the series

        *
       * *
      * * *
     * * * *
    * * * * *
    
  38. Program to print all Armstrong numbers between 1 to 1000.

  39. Find the factorial value of any number.

  40. Write a program to generate the series

    A B C D E F G F E D C B A
    A B C D E F   F E D C B A
    A B C D E       E D C B A
    A B C D           D C B A
    A B C               C B A
    A B                   B A
    A                       A
    
  41. Write a program to check whether a given number is prime or not.

  42. Write a program to generate all prime numbers between 1 to 1000.

  43. Write a program to calculate the sum of numbers (max 10 numbers). If the user enters a negative number loop terminates.

  44. Write a program that reads in 2 numbers x and y, and prints the largest common divisor of both x and y

  45. Write a program that reads in an integer n and prints all its divisors.

  46. Write a program that inputs a number (1-7) and prints the corresponding day of the week (switch case).

  47. Write a program that inputs a number (1-12) and the corresponding month of the year (switch case).

  48. Write a program that inputs the power (in watts) and outputs the lifespan of an electrical appliance. (switch case).

    • If watts = 25: lifespan = 2500
    • If watts = 40 or 60: lifespan = 1000
    • If watts = 75: lifespan = 700
    • Otherwise: lifespan = 0
  49. If the lengths of the sides of a triangle are denoted by a, b, and c, then the area of the represented triangle = √(S(S-a)(S-b)(S-c)), where S=(a+b+c)/2. Write a program to calculate the area of a triangle.

  50. Make a menu-driven program with the following functions:

    1. Check if the number is prime or not
    2. Check if the number is Armstrong or not
    3. Find the factorial of the number
    4. Exit
  51. Write a menu-driven program to perform a simple calculation on two numbers (addition, subtraction, multiplication, division).

  52. Write a menu-driven program to compute the areas of the various geometrical shapes.

  53. Write the program using switch-case to simulate traffic lights: R = STOP!, Y = CAUTION!, G = GO!

  54. Write a program to calculate X to the power Y using the inbuilt power function.

  55. Determine sin(x), cos(x) and tan(x) values for x=0, x=30, x=60, x=90. The output should be displayed as follows:

           X=0 X=30 x=60 x=90
    sin(x)
    cos(x)
    tan(x)
    
  56. getc(), getch(), getchar() and getche() are some of the functions related to characters. Determine what is their functionality. Create a program including all these inbuilt functions.

  57. Write a function to perform the addition on two numbers. (Hint: function with arguments and with return value.)

  58. Write a program to check whether a year is a leap year or not using functions.

  59. Write a program to find the sum of the squares of the first n numbers and calculate its sum.

  60. Write a program to calculate 1/1! + 2/2! + 3/3! + 4/4! + ... + n/n!

  61. Write a function that receives a float and an int from main(), finds the product of these two, and returns the product which is printed through main(). (Hint: Function with arguments and with return type.)

  62. Write a function that receives 5 integers and returns the sum, the average, and the standard deviation of these numbers. Call this function from main() and print the results in main().
    σ = √Σ(x - μ)) whole to the power 2 / N
    where

    • σ = population standard deviation
    • N = the size of the population
    • X = each value from the population
    • μ = the population mean
  63. Write a function that receives marks received by a student in 3 subjects and returns the average and percentage of these marks. Call this function from main() and print the results in main(). (Hint: Function with arguments and with return type.)

  64. Write a recursive function to obtain the first 25 numbers of a Fibonacci sequence. In a Fibonacci sequence, the sum of two successive terms gives the third term. Following are the first few terms of the Fibonacci sequence: 1 1 2 3 5 8 13 21 34 55 89... (Hint: Function with no arguments and no return type.)

About

lo bhai

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •