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

Oops

The document provides 9 programming problems to solve using C language. The problems cover a range of concepts including input/output, if/else conditional statements, loops, arrays, and calculating averages. They require the programmer to write code that checks if a number is positive, assigns grades based on test scores, calculates award points based on number of tickets, counts and sums negative numbers from user input, compares integers for equality, sets a value based on another value, checks eligibility criteria, and analyzes car speed data.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

Oops

The document provides 9 programming problems to solve using C language. The problems cover a range of concepts including input/output, if/else conditional statements, loops, arrays, and calculating averages. They require the programmer to write code that checks if a number is positive, assigns grades based on test scores, calculates award points based on number of tickets, counts and sums negative numbers from user input, compares integers for equality, sets a value based on another value, checks eligibility criteria, and analyzes car speed data.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

1.

Write a program to check whether the given number ‘N’ is positive or not using
if…else statement.

2. Write a program to input the Score value at run-time and display the Grade as
‘A’ when the Score is more than 90, and then to notify the termination of the
program by printing the statement “***End of the Program***” on console.

Test Case 1 Test Case 2


Enter Score: 91 Enter Score: 35

Grade: A ***End of the program***

***End of the program***

3. Consider you are going to create an application using C program to implement


the task of ticket counter. In which, the ticket counter needs to have two integer
variables such as UserTickets and AwardPoints, then he should input UserTickets
at runtime then execute AwardPoints is 1 when UserTickets is less than or equal to
5, otherwise execute AwardPoints is equal to UserTickets.

Test Case 1 Test Case 2


Enter UserTickets : 4 Enter UserTickets : 12

AwardPoints = 1 AwardPoints = 12

4. Assume that you are going to create a program which allows the user to read
some set of integers until the user enters ‘0’ and then count and add the negative
integers and display the same on the console.(using while loop)
Test Case :

Enter number (enter ‘0’ to terminate):

-1

-5

Count of Negative numbers: 2

Sum of the Negative number: -6

5. Write a C program to accept two integers and check whether they are equal or
not.

6. Write a C program to read the value of an integer m and display the value of n is
1 when m is larger than 0, 0 when m is 0 and -1 when m is less than 0.

7. Write a C program to determine eligibility for admission to a professional course


based on the following criteria:
Marks in Maths >=65
Marks in Phy >=55
Marks in Chem>=50
Total in all three subject >=190
or
Total in Math and Physics >=140
8. Assume that you are going to create a program which allows the user to read
some set of integers until the user enters ‘0’ and then count and add the negative
integers and display the same on the console.(using while loop)

Test Case :

Enter number (enter ‘0’ to terminate):

-1

-5

Count of Negative numbers: 2

Sum of the Negative number: -6

9. Write a C program to process a collection of the speeds of car. Your


program should count and print the number of cars moving at a high speed (
90 miles/hour or higher), the number of cars moving at a medium speed (50-
90 miles/hour), and the number of cars moving at a low speed (less than 50
mile/hour). Also display the average speed of a car ( a real number) at the end
of the run.

Test your program on the following data:


45 23 56 62 90 33 22 76 12 34

You might also like