0% found this document useful (0 votes)
4 views

PRICIPLE OF PROGRAMMING-PRACTICAL QUESTION

The document outlines practical programming questions for a course on Principles of Programming, focusing on basic programming concepts using C. It includes tasks related to variables, constants, operators, functions, arrays, and various programming challenges such as calculating sums, handling user input, and implementing conditional logic. The exercises aim to enhance programming skills through practical application of theoretical concepts.

Uploaded by

stephanor834
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
4 views

PRICIPLE OF PROGRAMMING-PRACTICAL QUESTION

The document outlines practical programming questions for a course on Principles of Programming, focusing on basic programming concepts using C. It includes tasks related to variables, constants, operators, functions, arrays, and various programming challenges such as calculating sums, handling user input, and implementing conditional logic. The exercises aim to enhance programming skills through practical application of theoretical concepts.

Uploaded by

stephanor834
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 5
INSTITUTE OF ACCOUNTANCY ARUSHA ITT 07212/ECU 07213: PRINCIPLE OF PROGRAMMING PRACTICAL QUESTIONS 1g, Variables and Constants, C : Introduction to Computer Program Operators 1 2. Modify the first program so that the program displays your name. Write a program that calculates and prints the sum of two integers on computer screen. Write a program that obtains two numbers from a user, computes the sum of these numbers and outputs the result on computer screen. Write a program that reads three integers from the keyboard, store them in the variables x, y and z, calculates the product of the three integers and prints the result on screen. Write a program that asks the user to enter two numbers, obtains them from the user and prints their sum, product, difference, quotient and remainder. Write a program that calculates and prints area and perimeter of a rectangle on computer screen. Page 1 of 5 7. Write a program that converts the temperature reading in degrees Fahrenheit, entered by user, into degrees Celsius. 8. Write a program that reads in the radius of a circle and prints the circle’s diameter, circumference and area. Use the constant value 3.14159 for 1. Topics: Selection Statements, Repetition Statements 9. Write a program that accepts two numbers, divides the first number by the second number and prints the result. 10.Write a program that asks the user to enter two integers, obtains the numbers from the user, then prints the larger number followed by the words “is larger.” If the numbers are equal, print the message “These numbers are equal.” 11.Write a program that inputs three different integers from the keyboard, then prints the sum, the average, the product, the smallest and the largest of these numbers. 12.Write a program that displays even numbers between 1 and 100 inclusive. 13.Write a program that calculates the sum of the first 200 counting integers. 14. Write a program that calculates the squares and cubes of the numbers from 0 to 10 and uses tabs to print the following table of values: number square cube 0 o 0 1 az 1 2 4 8 3 9 27 4 16 64 5 25 Bs 6 36 216 7 49 343 8 64 512 9 81 729 10 100 1000 Page 2 of S Topic: Functions 16.Write a function that receives 5 integers, calculates the sum and average of these numbers. Call this function from main() and print the results. 16.Write a C program that uses function which performs multiplication of 3 times 5, returns the product and prints out the return value from the function on computer screen 17.Write a C function to calculate the factorial value of any integer entered through the keyboard 18.Write C program that accepts input of two numbers. The program contains function addition for performing addition of two numbers; function subtraction for Performing subtraction of the second number from the first number; function multiplication for multiplication of the two numbers and function division to divide two numbers. The program should also give the user an option of performing one of the operations above and display the result on the screen. Topic: Arrays 19.Write a C program that initializes all 10 array elements to 1. 20.Write a C program to read scores of five students using array and print the array elements 21.Write C program that displays all 10 array elements on computer screen 22.Write a C program that calculates and displays the sum and average of all elements of an array, float numbers [6] = {50, 10, 20, 60, 120, 90}. Page 3 of S Others Questions 23.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. 24.Any year is input through the keyboard, Write a program to determine whether the year is a leap year or not. 25. If the ages of Ram, Shyam and Ajay are input through the keyboard, write a program to determine the youngest of the three. 26.The length & width of a rectangle and radius of a circle are input through the keyboard. Write a program to calculate the area & perimeter of the rectangle, and the area & circumference of the circle. 27.Two numbers are input through the keyboard into two locations C and D. Write a program to interchange the contents of C and D. 28.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. 29.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 basic salary. If the employee's salary is input through the keyboard write a program to find his gross salary. Page 4 of S 30.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. 31.A company insures its drivers in the following cases + Ifthe driver is married. = Ifthe driver is unmarried, male & above 30 years of age. + Ifthe driver is unmarried, female & above 25 years of age Inall other cases the driver is not insured. If the marital status, sex and age of the driver are the inputs, write a program to determine whether the driver is to be insured or not. Page 5 of 5

You might also like