Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added simp changes #1176

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
24 changes: 24 additions & 0 deletions Array in small
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

/ Program to take 5 values from the user and store them in an array
// Print the elements stored in the array
#include <stdio.h>

int main() {
int values[5];

printf("Enter 5 integers:\n");

// taking input and storing it in an array
for(int i = 0; i < 5; ++i) {
scanf("%d", &values[i]);

}

printf("Displaying integers:\n");

// printing elements of an array
for(int i = 0; i < 5; ++i) {
printf("%d\n", values[i]);
}
return 0;
}
24 changes: 24 additions & 0 deletions Cprogram -1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package Edureka;
import java.util.Scanner;
public class Palindrome {
static void checkPalindrome(String input) {
//Assuming result to be true
boolean res = true;
int length = input.length();
//dividing the length of the string by 2 and comparing it.
for(int i=0; i<= length/2; i++) {
if(input.charAt(i) != input.charAt(length-i-1)) {
res = false;
break;
}
}
System.out.println(input + " is palindrome = "+res);
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter your Statement: ");
String str = sc.nextLine();
//function call
checkPalindrome(str);
}
}
81 changes: 81 additions & 0 deletions Prime Numbers Between two Intervals
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
xample: Prime Numbers Between two Intervals

#include <iostream>

using namespace std;

int checkPrimeNumber(int);

int main() {

int n1, n2;

bool flag;

cout << "Enter two positive integers: ";

cin >> n1 >> n2;

// swapping n1 and n2 if n1 is greater than n2

if (n1 > n2) {

n2 = n1 + n2;

n1 = n2 - n1;

n2 = n2 - n1;

}

cout << "Prime numbers between " << n1 << " and " << n2 << " are: ";

for(int i = n1+1; i < n2; ++i) {

// If i is a prime number, flag will be equal to 1

flag = checkPrimeNumber(i);

if(flag)

cout << i << " ";

}

return 0;

}

// user-defined function to check prime number

int checkPrimeNumber(int n) {

bool isPrime = true;

// 0 and 1 are not prime numbers

if (n == 0 || n == 1) {

isPrime = false;

}

else {

for(int j = 2; j <= n/2; ++j) {

if (n%j == 0) {

isPrime = false;

break;

}

}

}

return isPrime;

}
27 changes: 27 additions & 0 deletions Swap 2 numbers in mini
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <iostream>

using namespace std;

int main()

{

int a = 5, b = 10, temp;

cout << "Before swapping." << endl;

cout << "a = " << a << ", b = " << b << endl;

temp = a;

a = b;

b = temp;

cout << "\nAfter swapping." << endl;

cout << "a = " << a << ", b = " << b << endl;

return 0;

}
2 changes: 2 additions & 0 deletions sort.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const sorting_stuff =['1','3','5'];
sorting_stuff.sort();