diff --git a/Task 2/IIB2025033/star.c b/Task 2/IIB2025033/star.c new file mode 100644 index 0000000..62a84d2 --- /dev/null +++ b/Task 2/IIB2025033/star.c @@ -0,0 +1,16 @@ +#include +int main() { + int n,i,j; + printf("Enter the no. of rows: "); + scanf("%d",&n); + for (i=1;i<=n;i++) { + for (j=1;j<=n-1;j++) { + printf(" "); + } + for (j=1;j<=2*i-1;j++) { + printf("*"); + } + printf("\n"); + } + return 0; +} diff --git a/Task 3/IIB2025033/calculator.txt b/Task 3/IIB2025033/calculator.txt new file mode 100644 index 0000000..0f2521f --- /dev/null +++ b/Task 3/IIB2025033/calculator.txt @@ -0,0 +1 @@ +Calculator is a device used to perform arithmatic operations on two or more numbers. diff --git a/Task 3/IIB2025033/calculator_code.c b/Task 3/IIB2025033/calculator_code.c new file mode 100644 index 0000000..fa52e25 --- /dev/null +++ b/Task 3/IIB2025033/calculator_code.c @@ -0,0 +1,33 @@ +#include +int main() { + int n1,n2,op; + printf("Enter the first no.: "); + scanf("%d",&n1); + printf("Enter the second no.: "); + scanf("%d",&n2); + printf ("Enter the operation to be done (1 for +, 2 for -, 3 for *, 4 for /"); + scanf("%d",&op); + if (op==1) { + printf("The sum of %d and %d is %d",n1,n2,n1+n2); + } + else if (op==2) { + if (n1>n2) { + printf("The difference between %d and %d is %d",n1,n2,n1-n2); + } + else { + printf("The difference between %d and %d is %d",n2,n1,n2-n1); + } + } + else if (op==3) { + printf("The product between %d and %d is %d",n1,n2,n1*n2); + } + else { + if (n2==0) { + printf("Invalid divison with 0"); + } + else { + printf("The quotient of %d upon dividing with %d is %d",n1,n2,n1/n2); + } + } + return 0; +}