You are on page 1of 3

ASSIGNMENT

NAME:UME FARWA ABBASI


FATHER NAME:AFTAB AHMED ABBASI
CLASS:IT
SUBJECT:PROGRAMMING FUNDAMENTAL
ROLL NO:132
SUBMITTED TO:SIR HAZAR KHAN CHANDIO
DIAMOND
#include <iostream>
using namespace std;

int main() {
int i,j,k;

for (int i = 1; i <=4; i++) {


for (int j = 1; j <= 4- i;j++) {
cout << " ";
}

for (int k = 1; k <=i*2-1; k++) {


cout << "*";
}

cout << endl;


}
for (i = 3; i>=1;i--)
{
for (j = 1; j <=4-i;j++) {
cout << " ";
}

for (k= 1; k <= 2 *i-1; k++) {


cout << "*";
}

cout << endl;


}

return 0;
}
FAHRENHEIT
#include <iostream>
using namespace std;

int main()
{
float c,f;

cout << "Enter the value of C ";


cin >>c;
f=(c*9/5) + 32;
cout<<"f"<<f;
return 0;
}
IF ELSE
#include <iostream>
using namespace std;

int main() {
int number;

cout << "Enter a number: ";


cin >> number;

if (number > 0) {
cout << number << " is positive." << endl;
} else if (number < 0) {
cout << number << " is negative." << endl;
} else {
cout << "The number is zero." << endl;
}

return 0;
}
LESS THAN
#include <iostream>

int main() {
int num1 = 10;
int num2 = 20;

if (num1 < num2) {


std::cout << num1 << " is less than " << num2 << "\n";
} else {
std::cout << num1 << " is not less than " << num2 << "\n";
}

return 0;
}
SQUARE
#include <iostream>

int main() {
int num = 5;
int square = num * num;

std::cout << "The square of " << num << " is " << square << std::endl;

return 0;
}
SWITCH
#include <iostream>

int main() {
int num = 2;

switch (num) {
case 1:
std::cout << "One\n";
break;
case 2:
std::cout << "Two\n";
break;
case 3:
std::cout << "Three\n";
break;
default:
std::cout << "Number not in range\n";
break;
}

return 0;
}

You might also like