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

Assignment No 2

The document contains the assignment submission of a student named Ghulam Mustafa for their FOCP Lab 2 course. The assignment includes 3 tasks - the first two involve writing C programs to print the student's name, registration number, semester, GPA and a favorite quote on separate lines, while the third task converts the first two programs to C++.

Uploaded by

Gm Imtiaz
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)
41 views

Assignment No 2

The document contains the assignment submission of a student named Ghulam Mustafa for their FOCP Lab 2 course. The assignment includes 3 tasks - the first two involve writing C programs to print the student's name, registration number, semester, GPA and a favorite quote on separate lines, while the third task converts the first two programs to C++.

Uploaded by

Gm Imtiaz
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/ 4

NATIONAL UNIVERSITY OF SCIENCES AND TECHNOLOGY

School of Electrical Engineering and Computer Sciences

National University of Sciences and Technology NUST Islamabad

COURSE NAME: FOCP LAB 2

ASSIGNMENT NO: 2

SUBMITTED BY: Ghulam Mustafa


REGISTRATION NO: 454131
CLASS: BESE-14-A
INSTRUCTOR: Momina Moetesum
DATE: 25-Sep-23
Task 1 [ C language]:
To Write a program which prints your name, registration number, semester and GPA on
separate lines with proper spaces.
Code:
#include <stdio.h>
int main() {
printf("Name: Ghulam Mustafa\n");
printf("Registration Number: 454131\n");
printf("Semester: Fall 2023\n");
printf("GPA: 3.75\n");
return 0;
}

Task 2:[ C language]:


Write a program which prints your favorite quote/saying in a proper format.
Note: Don’t forget to use quotation marks and writer’s name.
Code:
#include <stdio.h>
int main()
{
printf("Favorite Quote: \"It is never too late to be what you might have been \" - George Eliot\
n");
return 0;
}

Task#3(in C++ language):


To convert Task 1 and Task 2 in C++.

(a):
Code:
#include <iostream>
int main()
{
std::cout << "Name: Ghulam Mustafa\nRegistration Number: 454131\nSemester: Fall 2023\
nGPA: 3.75\n";
return 0;
}
(b):

Code:
#include <iostream>
int main()
{
using namespace std;
cout << "Favorite Quote: \"It is never too late to be what you might have been\" – George Eliot"
<< endl;
}

You might also like