Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Added Function #477

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
22 changes: 13 additions & 9 deletions C++ & C/10.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
#include<iostream>
#include <iostream>
using namespace std;
const double pi=3.14;
const char newline='\n';
int main(){
double r=5.0;
double circle;
circle=2*pi*r;
cout<<circle;
cout<<newline;

int main()
{
int firstNumber, secondNumber, sumOfTwoNumbers;

cout << "Enter two integers: ";
cin >> firstNumber >> secondNumber;

// sum of two numbers in stored in variable sumOfTwoNumbers
sumOfTwoNumbers = firstNumber + secondNumber;

// Prints sum
cout << firstNumber << " + " << secondNumber << " = " << sumOfTwoNumbers;

return 0;
}
// For Hacktoberfest2021
38 changes: 23 additions & 15 deletions Python/Bubble_Sort.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
# bubble sorting an array
#//---create a random list---//
# Code is more optimal from previous version
# Added comment from understanding the meaning

import random as rand
a=[]
for _ in range(10):
x=rand.randint(0,100)
a.append(x)
print ("random : ",a)
def bubbleSort(arr):
n = len(arr)

#//---logic to swap pair of no.---//
# Traverse through all array elements
for i in range(n):

for j in range (len(a)):
temp=a.copy()
for i in range(len(a)-1):
if a[i]>a[i+1]:
a[i],a[i+1]=a[i+1], a[i]
if temp==a:
break
print("sorted : ",a)
# Last i elements are already in place
for j in range(0, n-i-1):

# traverse the array from 0 to n-i-1
# Swap if the element found is greater
# than the next element
if arr[j] > arr[j+1] :
arr[j], arr[j+1] = arr[j+1], arr[j]

# Driver code to test above
arr = [64, 34, 25, 12, 22, 11, 90]

bubbleSort(arr)

print ("Sorted array is:")
for i in range(len(arr)):
print ("%d" %arr[i]),
13 changes: 7 additions & 6 deletions java/Patterns/pattern1.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
public class pattern1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();

for (int i = 1; i <= num; i++) {
for (int j = 1; j <= i; j++) {
System.out.print("*\t");
System.out.print("Enter a row Number: ");
int x = sc.nextInt();
for(int i=1;i<=x;i++){
for(int j=1;j<=i;j++){
System.out.print("*);
}
System.out.println();
System.out.println();
}

}
}