Lab Tasks

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Lab tasks:

 Write a program to print your name and university name using print f.
 Write a program to print your name and university name using cout.
 Write a program check the number and print pass.
 Write a program that add two value generated by user.
 Write a program that input the birth year from the user. If the birth year is later
than 2000, then the program outputs the string “You were born in the 21st century.
Nested If - demonstrate a nested if statement?
 Write a program to take temperature in Fahrenheit and convert into Celsius and
display the output?
 : Write a program To Calculate Total Cost of Apples. The Number Of apples and cost
per Apple is entered by the user
 Write a program in c++ to input your age in years, convert the age in months, days,
hours, minutes and seconds and then print all these values on the user.
 Write a C++ program to add all number entered by user until user enter 0.
 Write a program to calculate the electricity bill. Taking the number of units from user
by using ‘if-else if’ statement display the total bill.
 Input a single letter in a char variable if ‘m’ is input, print “you are male” otherwise
print “you are female” by using conditional expression operator.
 To find that user is applicable for scholarship or not. If both GPA and cgpa >3.00 they
are eligible for scholarship.
 Find Factors of a Positive Integer using for loop.
 Company decided to give bonus of 5% to employee if his/her year of service is more
than 5 years. Ask user for their salary and year of service and print the net bonus
amount.
 Q: A program has following rules for grading system:
 Below 25 - F
 25 to 45 - E
 45 to 50 - D
 50 to 60 - C
 60 to 80 - B
 Above 80 - A
 Ask user to enter marks and print the corresponding grade. Using And logical
operator.

 Write a program to print reverse pattern for alphabet.


 Write a program to print reverse pattern using do while loop for alphabet.
 Write a program to add First 10 number using do while loop.
 Write a program to find factorial using do while loop.
 Write a program to print inner outer loop using for loop.
 C++ program to swap two numbers with third variable.
 C++ program to swap two numbers without using third variable.
 C++ program to check leap year.
 C++ program to swap two numbers with third variable without using swap function.
 Write a program that reads an array of integers and find the largest and smallest
values. Implement the both for and while loop.
 Write a program to find positive number and also find factor using for loop and take
value from user.
 Write a program to print this pattern using nested for loop.

 Write a program to find greater value using nested if statement


 : Write a program to find greater value using If statement and operator and take
value from user.
 Write a program to find post and pre fix increment take value from user.
 Write a program to check vowel using if else statement.
 Write a program to find vowel using if else statement using getch.
 write a program to find product or 2 table.
 Q: Write a program to find factorial using for loop.
 Write a C++ program to find the second largest element in an array of integers.
 Write a C++ program to find the most frequent element in an array of integers
 Write a C++ program to separate even and odd numbers in an array of integers. Put
all even numbers first, and then odd numbers.
 Write a C++ program to move all negative elements of an array of integers to the end
of the array. This is done without changing the order of the positive and negative
elements of the array.
 Take 10 integer inputs from user and store them in an array. Again ask user to give a
number. Now, tell user whether that number is present in array or not.
 Define a function that prints a number with parameter.
 Define a function that prints a number without parameter.
 : Define two functions to pint the maximum and minimum number respectively
among three numbers enters by user.
 Write a function called maximum that accept three integer number as parameter.
 A person is eligible to vote if his age is greater than or equal to 18. Define a function
to find out it if he is eligible to vote.
 Write a program to print the Fibonacci sequence of a number using function in C++.
 Write a program to find the factors of a given number using functtion in c++.
 Write a C++ program to find the sum and average of one dimensional integer array
using functions
 Write a program that lets the user perform arithmetic operations on two numbers.
Your program must be menu driven, allowing the user to select the operation (+, -, *,
or /) and input the numbers. Furthermore, your program must consist of following
functions:
 Function showChoice: This function shows the options to the user and explains how
to enter data.
 Function add: This function accepts two number as arguments and returns sum.
 Function subtract: This function accepts two number as arguments and returns their
difference.
 Function mulitiply: This function accepts two number as arguments and returns
product.
 Function divide: This function accepts two number as arguments and returns
quotient.
 Write a program to print the address of the variable using pointers in function.
 Write a program using pointer through pass by reference by function.
 Write a program to print the value of user using pointers take value from user.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy