0% found this document useful (0 votes)
16 views8 pages

Assignment 03

The document contains code snippets and output from 3 tasks of a lab assignment submitted by a student. The code prints the student's name initials, comments on code, and outputs subject marks. The student is studying software engineering.

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)
16 views8 pages

Assignment 03

The document contains code snippets and output from 3 tasks of a lab assignment submitted by a student. The code prints the student's name initials, comments on code, and outputs subject marks. The student is studying software engineering.

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/ 8

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: 06-Oct-23
Task 1:

Code:

//My name: "Ghulam Mustafa" and today is 6 Oct 2023


#include <stdio.h>

int main()
{
// A comment , this is so you can read your program later.
// Anything after the // is ignored by C/C++/Java.

printf("I could have code like this.\n"); // and the comment after is ignored.

/* Want to use C-style to comment */

// You can also use a comment to "disable a piece of code:

// printf( "This won't run.\n" );

printf("This will run.\n");


//I am studying software engineering at SEECS

getch(); // or _getch()
return 0;

Output:

Task2:
Code:
#include<stdio.h>
int main() {
//This code will print my name initials "G M".

printf("*************************************************************
******************************\n");

printf(" ****************** * ** \n");


printf(" * ** ** \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * ******* * ** * \n");
printf(" * * * * \n");
printf(" * * * * \n");
printf(" ****************** * * \n");

printf("*************************************************************
****************************\n");
/*This code will print subjects and their relevent marks.*/

int marks1 = 98;


int marks2 = 91;
float marks3 = 88.8;
float marks4 = 72.9;

printf(" Calculus: %d\n",marks1);


printf(" Physics: %d\n",marks2);
printf(" Discrete Math: %f\n",marks3);
printf(" English: %f\n",marks4);

return 0;
}
Output:

Task3:
Code: //My name: "Ghulam Mustafa" and today is 6 Oct 2023
#include <iostream>
using namespace std;
int main()
{
// A comment , this is so you can read your program later.
// Anything after the // is ignored by C/C++/Java.

cout << "I could have code like this.\n"; // and the comment after is ignored.

/* Want to use C-style to comment */

// You can also use a comment to "disable a piece of code:


// cout << "This won't run.\n" ;

cout << "This will run.\n";


//I am studying software engineering at SEECS

getchar(); // or _getch()
return 0;

Code:

#include<iostream>
using namespace std;
int main() {
//This code will print my name initials "G M".

cout <<
"*****************************************************************************
**************\n";

cout << " ****************** * ** \n";


cout << " * ** ** \n";
cout << " * * * * * \n";
cout << " * * * * * \n";
cout << " * ******* * ** * \n";
cout << " * * * * \n";
cout << " * * * * \n";
cout << " ****************** * * \n";

cout <<
"*****************************************************************************
************\n";
/*This code will print subjects and their relevent marks.*/

int marks1 = 98;


int marks2 = 91;
double marks3 = 88.8;
double marks4 = 72.9;
cout << " Calculus: " << marks1 << endl;
cout << " Physics: " << marks2 << endl;
cout << " Discrete Math: " << marks3 << endl;
cout << " English: " << marks4 << endl;
getchar();
return 0;
}

You might also like