Document 52
Document 52
NAME:HALEMA DAOOD
ROLL NO:24F-6133
SECTION:BSEE-1B
TASK 01
#include <iostream>
int main()
int i = 2;
cout << i;
i = i + 2;
system(“pause”);
TASK 02
#include <iostream>
int main()
int i;
for (i = 10; i <= 60; i++)
if (i % 2==0)
cout << i;
system(“pause”);
TASK 03
#include <iostream>
int n;
";
cin >> n;
int a = 1, b = 2, next;
if (i == 1) {
continue;
if (i == 2) {
continue;
next = a + b;
a = b;
b = next;
return 0;
TASK 04
#include <iostream>
int main()
int n;
int factorial = 1;
cout << “enter a positive integer”;
cin >> n;
if (n <0) {
else {
int i = 1;
while (i <= 1) {
factorial *= i;
i++;
system(“pause”);
TASK 05
#include <iostream>
int main()
int number;
if (number == 0)
return 0;
}
if (number == 0)
return 0;
int digit_count = 0;
digit_count++;
cout << "The number has " << digit_count << " digits." <<
endl;
return 0;
TASK 06
#include <iostream>
int main()
int num = 5;
int guess;
cout << "Guess the number (between 1 and 10): ";
while (true) {
if (guess == num) {
break;
else
return 0;
TASK 07
#include <iostream>
int main()
sizeof(yearsWorked[0]);
for (int i = 0; i < numberOfEmployees; i++)
if (yearsWorked[i] > 5)
cout << "Employee " << i + 1 << " (worked " <<
yearsWorked[i]
endl;
else
cout << "Employee " << i + 1 << " (worked " <<
yearsWorked[i]
<< " years) does NOT qualify for the 10% bonus."
<< endl;
return 0;