Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Task 3/Q1/IIT2025262/calc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
A calculator is an tool that performs mathematical operations quickly.
It is used to make calculations faster and reduce human errors in maths and daily tasks.
1 change: 1 addition & 0 deletions Task 3/Q1/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
What is a calculator?
21 changes: 21 additions & 0 deletions Task 3/Q2/IIT2025262/calculator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include<iostream>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
int sum=a+b;
int diff=a-b;
int prod=a*b;
float div=a/b;
cout<<"Enter s-sum, d-diff,p-prod,d-div";
string s;
cin>>s;
if(s=="s")
cout<<sum;
if(s=="d")
cout<<diff;
if(s=="p")
cout<<prod;
if(s=="d")
cout<<div;
}
33 changes: 33 additions & 0 deletions Task 3/Q3/armstrong.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <iostream>
#include <cmath>
using namespace std;

int main() {
int num, originalNum, remainder;
int n = 0;
double result = 0;

cout << "Enter a number: ";
cin >> num;
originalNum = num;

int temp = num;
while (temp != 0) {
temp /= 10;
n++;
}

temp = num;
while (temp != 0) {
remainder = temp % 10;
result += pow(remainder, n);
temp /= 10;
}

if ((int)result == originalNum)
cout << originalNum << " is an Armstrong number.";
else
cout << originalNum << " is NOT an Armstrong number.";

return 0;
}
29 changes: 29 additions & 0 deletions Task 3/Q4/palindrome.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <iostream>
using namespace std;

int main() {
string s;
cout << "Enter a string or number: ";
cin >> s;

int start = 0;
int end = s.length() - 1;

bool isPalindrome = true;

while (start < end) {
if (s[start] != s[end]) {
isPalindrome = false;
break;
}
start++;
end--;
}

if (isPalindrome)
cout << "It is a palindrome.";
else
cout << "It is NOT a palindrome.";

return 0;
}
Empty file added Task 3/Q5/prime
Empty file.
29 changes: 29 additions & 0 deletions Task 3/Q5/prime.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <iostream>
using namespace std;

int main() {
int num;
cout << "Enter a number: ";
cin >> num;

if (num <= 1) {
cout << "Not a prime number.";
return 0;
}

bool isPrime = true;

for (int i = 2; i * i <= num; i++) {
if (num % i == 0) {
isPrime = false;
break;
}
}

if (isPrime)
cout << "Prime number";
else
cout << "Not a prime number";

return 0;
}