diff --git a/Task 2/IIT2025217/ASCII_box.c b/Task 2/IIT2025217/ASCII_box.c new file mode 100644 index 0000000..50c2df9 --- /dev/null +++ b/Task 2/IIT2025217/ASCII_box.c @@ -0,0 +1,19 @@ +#include +#include + +int main(){ + char phrase[100]; + scanf("%s",phrase); + int x=strlen(phrase); + for(int i=0;i +int mian(){ + float a,b; + printf("1.Add/n`2.Sub/n4.Mult/n5.Div/n"); + int c; + scanf("%d",c); + printf("Enter the two numbers:/n"); + scanf("%f%f,&a&b"); + + switch (c){ + case 1: printf("%f/n",a+b); + break; + case 2: printf("%f/n",a-b); + break; + case 3: printf("%f/n",a*b); + break; + case 4: if(b==0){ + printf("Invalid/n"); + } + else{ + printf("%f/n",a/b); + } + break; + + } + return 0; +} diff --git a/Task 3/Q2/IIT2025232/a.exe b/Task 3/Q2/IIT2025232/a.exe deleted file mode 100644 index 4350257..0000000 Binary files a/Task 3/Q2/IIT2025232/a.exe and /dev/null differ diff --git a/Task 3/Q2/IIT2025232/calculator.c b/Task 3/Q2/IIT2025232/calculator.c deleted file mode 100644 index 836a067..0000000 --- a/Task 3/Q2/IIT2025232/calculator.c +++ /dev/null @@ -1,30 +0,0 @@ -#include - -int main() -{ - printf("For addition press 1, for substraction press 2, for multiplication press 3, for division press 4\n"); - int a; - int b; - int c; - printf("Input the operation that you want too do . \n"); - scanf("%d",&a); - printf("Enter the two numbers\n"); - scanf("%d %d",&b,&c); - if(a == 1) - { - printf("%d",b+c); - } - if(a == 2) - { - printf("%d",b-c); - } - if(a == 3) - { - printf("%d",b*c); - } - if(a == 4) - { - printf("%d",b/c); - } - -} \ No newline at end of file diff --git a/Task 3/Q2/IIT2025259/calculator.c b/Task 3/Q2/IIT2025259/calculator.c deleted file mode 100644 index 9e1fc16..0000000 --- a/Task 3/Q2/IIT2025259/calculator.c +++ /dev/null @@ -1,39 +0,0 @@ -#include - -int main() { - printf("Choose Operation:\n"); - printf("1. Addition\n"); - printf("2. Subtraction\n"); - printf("3. Multiplication\n"); - printf("4. Division\n"); - int ch; - scanf("%d", &ch); - double num1, num2, result; - if (ch >= 1 && ch <= 4) { - printf("Enter two numbers: "); - scanf("%lf %lf", &num1, &num2); - } - switch (ch) { - case 1: - result = num1 + num2; - printf("Result = %.2lf\n", result); - break; - case 2: - result = num1 - num2; - printf("Result = %.2lf\n", result); - break; - case 3: - result = num1 * num2; - printf("Result = %.2lf\n", result); - break; - case 4: - if (num2 != 0) { - result = num1 / num2; - printf("Result = %.2lf\n", result); - } else { - printf("Are you braindead?\n"); - } - break; - } - return 0; -} \ No newline at end of file diff --git a/Task 3/Q2/iit2025179/calc.cpp b/Task 3/Q2/iit2025179/calc.cpp deleted file mode 100644 index a2eebc8..0000000 --- a/Task 3/Q2/iit2025179/calc.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include -using namespace std; - -int main() { - double a, b; - char op; - - cout << "Enter a: "; - cin >> a; - - cout << "Enter b: "; - cin >> b; - - cout << "Enter operation (+, -, *, /): "; - cin >> op; - - if (op == '+') { - cout << "Result: " << a + b; - } - else if (op == '-') { - cout << "Result: " << a - b; - } - else if (op == '*') { - cout << "Result: " << a * b; - } - else if (op == '/') { - if (b == 0) { - cout << "Error: division by zero"; - } else { - cout << "Result: " << a / b; - } - } - else { - cout << "Invalid operation"; - } - - return 0; -} - diff --git a/Task 3/Q3/IIT2025259/armstrong.c b/Task 3/Q3/IIT2025259/armstrong.c deleted file mode 100644 index b129436..0000000 --- a/Task 3/Q3/IIT2025259/armstrong.c +++ /dev/null @@ -1,21 +0,0 @@ -#include - -int main() { - printf("Enter an integer: "); - int n; - scanf("%d", &n); - int s; - - for (int a = n; a > 0; a/=10) { - int d = a % 10; - int c = d * d * d; - s += c; - } - - if (s == n) { - printf("%d is an Armstrong number.\n", n); - } else { - printf("%d is not an Armstrong number.\n", n); - } - return 0; -} \ No newline at end of file diff --git a/Task 3/Q3/iit2025179/armstrong.cpp b/Task 3/Q3/iit2025179/armstrong.cpp deleted file mode 100644 index aa0cc95..0000000 --- a/Task 3/Q3/iit2025179/armstrong.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include -using namespace std; - -int main() { - int n, original, remainder; - int sum = 0; - - cout << "Enter a number: "; - cin >> n; - - original = n; - - while (n > 0) { - remainder = n % 10; - sum = sum + (remainder * remainder * remainder); - n = n / 10; - } - - if (sum == original) { - cout << "It is an Armstrong number"; - } else { - cout << "It is not an Armstrong number"; - } - - return 0; -} - diff --git a/Task 3/Q3/iit2025217/armstrong.c b/Task 3/Q3/iit2025217/armstrong.c new file mode 100644 index 0000000..819e027 --- /dev/null +++ b/Task 3/Q3/iit2025217/armstrong.c @@ -0,0 +1,26 @@ +#include +#include +int main(){ + int n; + printf("enter no: "); + scanf("%d",&n); + int i=1,m=n; + while(m!=0){ + m=m/10; + i++; + } + int sum=0; + m=n; + while(n!=0){ + sum+=pow((n%10),i); + n=n/10; + } + if(m==sum){ + printf("ARmstrong\n"); + } + else{ + printf("not armstrong\n"); + } + return 0; +} + diff --git a/Task 3/Q4/IIT2025259/palindrome.c b/Task 3/Q4/IIT2025259/palindrome.c deleted file mode 100644 index 64e0d80..0000000 --- a/Task 3/Q4/IIT2025259/palindrome.c +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include - -int main() { - printf("Enter a string: "); - char str[100]; - scanf("%s", str); - - for (int i = 0; i < strlen(str); i++) { - if (str[i] != str[strlen(str) - i - 1]) { - printf("%s is not a palindrome.\n", str); - return 0; - } - } - printf("%s is a palindrome.\n", str); - return 0; -} \ No newline at end of file diff --git a/Task 3/Q4/iit2025179/palindrome.cpp b/Task 3/Q4/iit2025179/palindrome.cpp deleted file mode 100644 index 5a70565..0000000 --- a/Task 3/Q4/iit2025179/palindrome.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include -using namespace std; - -int main() { - string s; - int i, j; - bool isPalindrome = true; - - cout << "Enter a string: "; - cin >> s; - - i = 0; - j = s.length() - 1; - - while (i < j) { - if (s[i] != s[j]) { - isPalindrome = false; - break; - } - i++; - j--; - } - - if (isPalindrome) { - cout << "The string is a palindrome"; - } else { - cout << "The string is not a palindrome"; - } - - return 0; -} - diff --git a/Task 3/Q4/iit2025217/palindrome.c b/Task 3/Q4/iit2025217/palindrome.c new file mode 100644 index 0000000..fe9a141 --- /dev/null +++ b/Task 3/Q4/iit2025217/palindrome.c @@ -0,0 +1,20 @@ +#include +#include +int main(){ + char str[50]; + scanf("%s",str); + int flag=0, n=strlen(str); + for(int i=0;i -using namespace std; - -int main() { - string s; - cin >> s; - string t = s; - reverse(t.begin(), t.end()); - if (s == t) cout << "Palindrome\n"; - else cout << "Not Palindrome\n"; - return 0; -} \ No newline at end of file diff --git a/Task 3/Q5/IIT2025259/prime b/Task 3/Q5/IIT2025259/prime deleted file mode 100755 index c1e2a0a..0000000 Binary files a/Task 3/Q5/IIT2025259/prime and /dev/null differ diff --git a/Task 3/Q5/IIT2025259/prime.c b/Task 3/Q5/IIT2025259/prime.c deleted file mode 100644 index 393dd58..0000000 --- a/Task 3/Q5/IIT2025259/prime.c +++ /dev/null @@ -1,18 +0,0 @@ -#include - -int main() { - printf("Enter an integer\n"); - int n, count = 0; - scanf("%d", &n); - for (int i = 2; i <= n / 2; i++) { - if (n % i == 0) { - count ++; - } - } - if (count == 0) { - printf("%d is a prime number\n", n); - } else { - printf("%d is not a prime number\n", n); - } - return 0; -} \ No newline at end of file diff --git a/Task 3/Q5/iit2025179/prime.cpp b/Task 3/Q5/iit2025179/prime.cpp deleted file mode 100644 index 1784566..0000000 --- a/Task 3/Q5/iit2025179/prime.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include -using namespace std; - -int main() { - int n; - bool isPrime = true; - - cout << "Enter a number: "; - cin >> n; - - if (n <= 1) { - isPrime = false; - } else { - for (int i = 2; i <= sqrt(n); i++) { - if (n % i == 0) { - isPrime = false; - break; - } - } - } - - if (isPrime) { - cout << "Prime Number"; - } else { - cout << "Not Prime Number"; - } - - return 0; -} - diff --git a/Task 3/Q5/iit2025217/q5.c b/Task 3/Q5/iit2025217/q5.c new file mode 100644 index 0000000..430dd14 --- /dev/null +++ b/Task 3/Q5/iit2025217/q5.c @@ -0,0 +1,20 @@ +#include +int main(){ + int n,flag=0; + scanf("%d",&n); + + for(int i=2;i -using namespace std; - -int main() { - double num1, num2; - char op; - - cout << "Enter first number: "; - cin >> num1; - - cout << "Enter an operator (+, -, *, /): "; - cin >> op; - - cout << "Enter second number: "; - cin >> num2; - - switch(op) { - case '+': - cout << "Result = " << num1 + num2; - break; - case '-': - cout << "Result = " << num1 - num2; - break; - case '*': - cout << "Result = " << num1 * num2; - break; - case '/': - if (num2 != 0) - cout << "Result = " << num1 / num2; - else - cout << "Error: Division by zero!"; - break; - default: - cout << "Invalid operator!"; - } - - return 0; -} -