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

PF 1

Uploaded by

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

PF 1

Uploaded by

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

Programming Fundamentals

Name: Noor Fatima

Student ID: 2243789

Submission Date: November 1, 2024

 Write a C++ program to check if a number is positive.

#include <iostream>

using namespace std;

int main()

int num = 2;

if(num > 0) {

cout<<"Num is positive";

return 0;

 Write a C++ program to check if a number is even.

#include <iostream>

using namespace std;

int main()

{
int n = 10;

if (n % 2 == 0) {

cout <<"Number is even";

return 0;

 Write a C++ program to check if a person is eligible to vote (age >= 18)

#include <iostream>

using namespace std;

int main()

int age = 20;

if(age >= 18){

cout<<"Eligible";

return 0;

 Write a C++ program to check if a person passed an exam (marks >= 50)

#include <iostream>

using namespace std;


int main()

int marks = 80;

if(marks >= 50){

cout<<"Student is passed";

return 0;

 Write a C++ program to check if a number is a multiple of 5

#include <iostream>

using namespace std;

int main()

int n = 50;

if(n % 5 == 0){

cout<<"Number is multiple of 5";

return 0;

}
 Write a C++ program to check if a number is positive or negative

#include <iostream>

using namespace std;

int main()

int num = 2;

if(num > 0) {

cout<<"Num is positive";

else{

cout<<"Number is negative";

return 0;

 Write a C++ program to find if a number is even or odd.

#include <iostream>

using namespace std;

int main()

int n = 10;

if (n % 2 == 0) {

cout <<"Number is even";


} else {

cout <<"Number is odd";

 Write a C++ program to check if a person is eligible to vote or not based on age

#include <iostream>

using namespace std;

int main()

int age = 20;

if(age >= 18){

cout<<"Eligible";

else{

cout<<"Not eligible";

 Write a C++ program to check if a student passed or failed based on marks (pass
if >= 50)

#include <iostream>

using namespace std;

int main()

{
int marks = 80;

if(marks >= 50){

cout<<"Student is passed";

else{

cout<<"Student is failed";

 Write a C++ program to check if a number is divisible by 3 or not.

#include <iostream>

using namespace std;

int main()

int n = 12;

if(n % 3==0){

cout<<"Number is divisible";

else{

cout<<"Number is not divisible";

You might also like