0% found this document useful (0 votes)
11 views6 pages

PF Lab 1 Manual

The document outlines instructions for submitting programming assignments in C/C++, emphasizing the use of Visual Studio, proper code formatting, and meaningful variable names. It includes learning objectives related to arrays and problem-solving, along with specific lab tasks that require debugging and writing various C++ programs. Tasks range from classifying student grades to printing patterns and checking number properties.

Uploaded by

N B
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views6 pages

PF Lab 1 Manual

The document outlines instructions for submitting programming assignments in C/C++, emphasizing the use of Visual Studio, proper code formatting, and meaningful variable names. It includes learning objectives related to arrays and problem-solving, along with specific lab tasks that require debugging and writing various C++ programs. Tasks range from classifying student grades to printing patterns and checking number properties.

Uploaded by

N B
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Programming Fundamentals

Instructions:
 You must submit CPP files of the program in a folder, named your Registration
Number.
 You must upload your lab tasks on CMS.
 All program codes should be written in C/C++. Students should use Visual studio
compiler for coding.
 Indent and comment your code.
 Use meaningful variable names
 Plan your code carefully on a piece of paper before you implement it.

Learning Objectives:
 Demonstrate knowledge of basic arrays in programming C++. (Revision)
Blooms
CLO NO CLO STATEMENT Taxonomy PLO
Level

Create solutions for real-world issues while


staying within restrictions and making the
1 P3 5
most use of available resources by utilizing
sophisticated problem-solving methods.

Lab 01
Topic ITC-Revision
 Introduction & Review
o Program Execution Flow, Concept of TYPE, Identifier, Declaration,
Initialization, Expression, Assignment, Selection, Loop, Arrays
Objective  Array
o Integer, Character, C-String
o Declaration, Initialization, one by one Input/Output.
______________________________________________________________________________
______________________________________________________________________________
TASK TO DO
Task 1:
Debug the code line by line and understand it’s working.
#include <iostream>
using namespace std;
int main()
{
int arr[] = {10, 20, 30, 40, 50};
int size = 5;
cout << "Array elements are:" << endl;
for (int i = 0; i < size; i++)
{
cout << "arr[" << i << "] = " << arr[i] << endl;
}
arr[2] = 100;
cout << " New Array is:" << endl;
for (int i = 0; i < size; i++)
{
cout << "arr[" << i << "] = " << arr[i] << endl;
}
return 0;
}
______________________________________________________________________________

Task 2:

Write a C++ program that reads an integer representing a student's grade (between 0 and 100)
and classifies it into one of the following categories:

 A: Grade between 90 and 100


 B: Grade between 80 and 89
 C: Grade between 70 and 79
 D: Grade between 60 and 69
 F: Grade below 60

The program should then output the letter grade (A, B, C, D, or F).

Sample Input:
Enter marks= 85
Sample Output:
Grade = B
Task 3:
Write a C++ program that prints all even numbers from 1 to a given number n.
Sample Input:
Enter a number = 10
Sample Output:
Even numbers are = 2 4 6 8 10
_____________________________________________________________________________

Task 4:
Write a C++ program that prints a right-angled triangle pattern of stars (*) with n rows. The
number of stars in each row is equal to the row number.
Sample Input :
Enter number of rows = 5

Sample Output :
*
**
***
****
*****

Task 5:
Write a C++ program that takes an integer input and checks whether the number is positive,
negative, or zero.

Sample Input:
Enter number= -5

Sample Output:
Number is negative

______________________________________________________________________________

Task 6:
Write a C++ program to print a diamond pattern using stars (*). The program should take the
number of rows as input (which should be odd to create a symmetric pattern).
Sample Input:
Enter the number of rows: 5
Sample Output:
*
**
***
**
*

Task 7:
Debug the given code line by line and understand it’s working.

#include <iostream>
using namespace std;

int main()
{
int n, m;

cout << "Enter the number of rows: ";


cin >> n;
cout << "Enter the number of columns: ";
cin >> m;

for (int i = 1; i <= n; i++)


{
for (int j = 1; j <= m; j++)
{
if (i == 1 || i == n || j == 1 || j == m)
{
cout << "*";
}
else
{
cout << " ";
}
}
cout << endl;
}

return 0;
}
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________

End of LAB 1 😊

You might also like