S

@SammySadf0514

Area of Triangle Using Heron's Formula

C
2 years ago
#include <stdio.h> #include <math.h> float heronsFormula(float a, float b, float c) { float s; float area; s = (a + b + c) / 2; area = sqrt(s * (s - a) * (s - b) * (s - c)); return area;

Compound Interest

C
2 years ago
#include <stdio.h> #include <math.h> int main() { float principal, rate, time, CI, finalAmount; printf("Enter the principal amount: \n"); scanf("%f", &principal);

Transpose of a Matrix

NodeJS
2 years ago
function transpose(matrix) { const rows = matrix.length const col = matrix[0].length const transposedMatrix = [] for(let j = 0; j < col; j++) { transposedMatrix[j] = [] for(let i = 0; i < rows; i++) { transposedMatrix[j][i] = matrix[i][j]

Check Whether an Object is Empty or Not

NodeJS
2 years ago
function isEmpty(obj) { for(var key in obj) { if(obj.hasOwnProperty(key)) return false } return true } let obj = { name: "Sameer",

check whether a number is the multiple of 7

Python
2 years ago
#check whether a number is the multiple of 7 num = int(input("Enter a number: ")) if(num % 7 == 0): print(num,"is a multiple of 7") else: print(num,"is not a multiple of 7")

program to check the greatest among 3 numbers

Python
2 years ago
#program to check the greatest among 3 numbers num1 = int(input("Enter 1st number: ")) num2 = int(input("Enter 2nd number: ")) num3 = int(input("Enter 3rd number: ")) gr = num1 if(gr > num2): if(gr > num3):

Check whether the given number is Even or Odd

Python
2 years ago
#program to check if the number entered is even or odd num = int(input("Enter any number: ")) if(num == 0): print(num," is equal to zero(neither odd nor even)") else: if(num % 2 == 0): print(num," is an even number")

Safia in JavaScript

NodeJS
2 years ago
const profile = { name: "safiaq_ueen", posts: 7, followers: 53, following: 51, bio: "@$AFIA___$ADAF \nits_Shona \nAlhmdulliah \nflw own rules \nattitude depends on uh \nQueen no need", verified: true, }; console.log(profile["bio"]);

Guess the number with 3 chances only

C
2 years ago
#include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int secretNumber, guess, chances = 3; srand(time(NULL));

Multiplication of two arrays

C
2 years ago
#include <stdio.h> int main() { int arr1[100],arr2[100],size1,size2; int prarray[100],i,j; printf("Enter the size of array 1: "); scanf("%d",&size1); printf("Enter the size of array 2:\n "); scanf("%d",&size2);

Adding digits of the Number

C
2 years ago
#include <stdio.h> int main() { int i,j,k,sum; printf("Enter the number: "); scanf("%d",&i); while(i>0){ j=i%10; sum=(sum)+j; i=i/10;

Reverse Number

C
2 years ago
#include <stdio.h> int main() { int i,j,k,rev; printf("Enter the number: "); scanf("%d",&i); while(i>0){ j=i%10; rev=(rev*10)+j; i=i/10;

Simple Calculator using if-else

C
2 years ago
#include <stdio.h> int main() { float a,b,result; int c; printf("Enter the no.: "); scanf("%f %f",&a,&b); printf("1 for addition.\n2 for subtraction.\n3 for Multiplication.\n4 for division.\n"); printf("Enter the operation: ");

Multiplication of Matrices

C
2 years ago
#include <stdio.h> int main() { int row1, col1, row2, col2, i, j, k; printf("Enter dimensions of the first matrix (rows columns): "); scanf("%d %d", &row1, &col1); printf("Enter dimensions of the second matrix (rows columns): "); scanf("%d %d", &row2, &col2);

Greatest among 3 numbers

C
2 years ago
#include <stdio.h> int main() { int num1, num2, num3, greatest; // Input three numbers printf("Enter three numbers: \n"); scanf("%d %d %d", &num1, &num2, &num3); // Compare num1 and num2

Pattern using for loop

C
2 years ago
#include <stdio.h> int main() { int i,j; for(i=1;i<=5;i++) { for(j=1;j<=i;j++) { printf("%d",j); }

Quadratic Equation

C
2 years ago
#include <stdio.h> #include <math.h> int main() { float a, b, c, x1, x2, d; printf("Enter coefficients (a, b, c): "); scanf("%f %f %f", &a, &b, &c); // Calculate discriminant d = b * b - 4 * a * c;

Pattern of numbers

C
2 years ago
#include<stdio.h> int main() { int i, j,n; printf("Enter the number of rows: \n"); scanf("%d",&n); for (i = 1; i <= n; i++) { for(j=1;j<=i;j++) {

Reversing a number

C
2 years ago
#include<stdio.h> int main() { int i,rem,rev=0, sum=0; printf("Enter the no. to reversed: \n"); scanf("%d",&i); while(i!=0) { rem=i%10;