Professional Documents
Culture Documents
Lab Task 26102022
Lab Task 26102022
#include <iostream>
int main()
{
int no;
if (no % 5 == 0 && no % 11 == 0)
{
cout << "It is divisible by 5 and 11" << endl;
}
else
{
cout << "It is not divisible by 5 and 11" <<
endl;
}
}
SIMPLE CALCULATOR
# include <iostream>
using namespace std;
int main() {
char op;
float num1, num2;
switch(op) {
case '+':
cout << num1 << " + " << num2 << " = " << num1 + num2;
break;
case '-':
cout << num1 << " - " << num2 << " = " << num1 - num2;
break;
case '*':
cout << num1 << " * " << num2 << " = " << num1 * num2;
break;
case '/':
cout << num1 << " / " << num2 << " = " << num1 / num2;
break;
default:
// If the operator is other than +, -, * or /, error message is shown
cout << "Error! operator is not correct";
break;
}
return 0;
}
#include<iostream>
using namespace std;
int main()
{
char num;
cout<<"Enter a character:"<<endl;
cin>>num;
switch(num>='a'&& num<='z'||num>='A'&& num<='Z')
{
case 1:
cout<<"It's alphabet"<<endl;
break;
case 0:
switch(num>='0' && num<='9')
{
case 1:
cout<<"It's digit"<<endl;
break;
case 0:
cout<<"It's not alphabet and not digit"<<endl;
break;
}
break;
}
}
Output
PROFIT AND LOSS
// C++ code to demonstrate Profit and Loss
#include <iostream>
return profit;
return Loss;
// Driver Code.
int main()
else
return 0;
OUTPUT :
500 Profit