0% found this document useful (0 votes)
8 views3 pages

PF Assignment 1

The document outlines an assignment for the Programming Fundamentals course at the National University of Modern Languages, requiring students to submit a word file by March 7, 2025, with specific formatting and no tolerance for late submissions. It includes two C++ programming tasks that need to be corrected for errors and their outputs illustrated. Plagiarism will result in a zero for the assignment.

Uploaded by

techvsfun786
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)
8 views3 pages

PF Assignment 1

The document outlines an assignment for the Programming Fundamentals course at the National University of Modern Languages, requiring students to submit a word file by March 7, 2025, with specific formatting and no tolerance for late submissions. It includes two C++ programming tasks that need to be corrected for errors and their outputs illustrated. Plagiarism will result in a zero for the assignment.

Uploaded by

techvsfun786
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

National University of Modern Languages (NUML)

Faisalabad Campus

Department of Computer Science


Course Code CSPF-141
Course Title Programming Fundamentals
Assignment 1
Due Date 07-Mar-2025
Instructions:
 Every student needs to submit a word file against this assignment with proper name
format (e.g., Assignment#1_PF_UserNameLastDigits)
 If found plagiarism, straight zero will be marked against assignment.
 Submit Assignment on Due Date. No Late Submission will be Tolerated.

[Question # 1] [CLO1] [UNDERSTANDING] [C2] [PLO2] [5 X 2=


10]

Rephrase the following C++ codes to make it error free and Also Illustrate the output
afterwards:

C++ Program to Find Cube of a Number


$include <iostream>
using namespace sdt;

int Main()
{
int n ; cube;

// Asking for input


cout << “Enter a number:”
cin >> num;

// Finding cube
cube = n * n;

// Displaying result
cout < "Cube of " < n < " is: " < cube < endl;
return 100;
}
Error Free C++ Code
Output of the Above C++ Code

C++ Program to Compute Quotient and Remainder


#include “iostream”
using namespace sdt;

int main()
{
int divisor, dividend, quotient, remainder;

coutput << "Enter dividend: ";


cinput >> dividend;

coutput << "Enter divisor: ";


cinput >> dividend;

quotient = dividend % divisor;


remainder = dividend / divisor;

coutput << Quotient = << q << endl;


coutput << Remainder = << r;

return 1;
}

Error Free C++ Code

Output of the Above C++ Code

You might also like