diff --git a/C++/Program-6/Readme.md b/C++/Program-6/Readme.md new file mode 100644 index 00000000..00f303b9 --- /dev/null +++ b/C++/Program-6/Readme.md @@ -0,0 +1,10 @@ +Program 6 + +Write a program to find the greatest common divisor of two number. + +Variable description-- + +x=Holds the first number + +y=Holds the second number + diff --git a/C++/Program-6/program.cpp b/C++/Program-6/program.cpp new file mode 100644 index 00000000..23a755c2 --- /dev/null +++ b/C++/Program-6/program.cpp @@ -0,0 +1,16 @@ +#include +using namespace std; +int gcd(int x,int y) +{ + if(y==0) + return x; + return gcd(y,x%y); +} + +int main() { + cout<<"enter the numbers\n"; + int x,y; + cin>>x>>y; + cout<<"The GCD is "< +#include + +char primecheck(int); + +int main() +{ + int i,num1,num2,cases; + char ans; + printf("Enter Number of Test Cases: "); + scanf("%d",&cases); + while (cases--) + { + printf("Enter First Number: "); + scanf("%d",&num1); + printf("Enter Second Number: "); + scanf("%d",&num2); + + printf("Answer: "); + for(i=num1;i<=num2;i++) + { + ans = primecheck(i); + if (ans == 'y') + printf("%d ",i); + } + printf("\n"); + } + return 0; +} + +char primecheck(int num) +{ + int i; + if (num == 0 || num == 1) + return 'n'; + else + { + for(i=(num-1);i>1;i--) + { + if(num%i == 0) + { + return 'n'; + } + else + continue; + } + return 'y'; + } + +} \ No newline at end of file diff --git a/C/README.md b/C/README.md index 936b65b6..f5d269b5 100644 --- a/C/README.md +++ b/C/README.md @@ -62,6 +62,7 @@ | Program-58 | Program to find the sum of elements between indexes | | Program-59 | Program to Search Students details in a list | | Program-60 | Program to print kaprekar number in a given range | +| Program-61 | Program to find the all the prime numbers between the numbers | diff --git a/Java/program-3/program.java b/Java/program-3/program.java index a108adc6..95be6346 100644 --- a/Java/program-3/program.java +++ b/Java/program-3/program.java @@ -8,10 +8,10 @@ public static void main(String args[]) int v=0; for(int i=0;i + + + +

My First Web Page

+

My First Paragraph.

+ +

+ + + + + \ No newline at end of file diff --git a/Javascript/program-10/read.md b/Javascript/program-10/read.md new file mode 100644 index 00000000..b6ac8af1 --- /dev/null +++ b/Javascript/program-10/read.md @@ -0,0 +1,4 @@ +# Program-10 + +## This is a javascript program for javascript writing into an html element + diff --git a/Javascript/program-9/program-9.html b/Javascript/program-9/program-9.html new file mode 100644 index 00000000..6c8a1d04 --- /dev/null +++ b/Javascript/program-9/program-9.html @@ -0,0 +1,16 @@ + + + + +

My First Web Page

+

My first paragraph.

+ +

Never call document.write after the document has finished loading. +It will overwrite the whole document.

+ + + + + \ No newline at end of file diff --git a/Javascript/program-9/read.md b/Javascript/program-9/read.md new file mode 100644 index 00000000..cb69f65a --- /dev/null +++ b/Javascript/program-9/read.md @@ -0,0 +1,4 @@ +# Program-9 + +## This is a javascript program for javascript writing into html output + diff --git a/Python/program-17/program.py b/Python/program-17/program.py new file mode 100644 index 00000000..61155765 --- /dev/null +++ b/Python/program-17/program.py @@ -0,0 +1,10 @@ +for i in range(1,6): + for j in range(1,6-i): + print(" ",end=" ") + for k in range(1,i+1): + print(k,end=" ") + if i>1: + for l in range(1,i+1): + print(l,end=" ") + print() + diff --git a/Python/program-17/readme.md b/Python/program-17/readme.md new file mode 100644 index 00000000..bbaed778 --- /dev/null +++ b/Python/program-17/readme.md @@ -0,0 +1,7 @@ +PROGRAM-17 +To print the given pattern(pattern.py) + 1 + 1 2 1 2 + 1 2 3 1 2 3 + 1 2 3 4 1 2 3 4 +1 2 3 4 5 1 2 3 4 5 diff --git a/Python/program-18/program.py b/Python/program-18/program.py new file mode 100644 index 00000000..456583e0 --- /dev/null +++ b/Python/program-18/program.py @@ -0,0 +1,4 @@ +for i in range(1,6): + for j in range(1,i+1): + print(i,end=' ') + print() diff --git a/Python/program-18/readme.md b/Python/program-18/readme.md new file mode 100644 index 00000000..6da7659a --- /dev/null +++ b/Python/program-18/readme.md @@ -0,0 +1,6 @@ +program to print the given pattern +1 +2 2 +3 3 3 +4 4 4 4 +5 5 5 5 5 diff --git a/Python/program-19/program.py b/Python/program-19/program.py new file mode 100644 index 00000000..80444473 --- /dev/null +++ b/Python/program-19/program.py @@ -0,0 +1,14 @@ +#Python Program to Convert Decimal to Binary + +def decimalToBinary(num): + """This function converts decimal number + to binary and prints it""" + if num > 1: + decimalToBinary(num // 2) + print(num % 2, end='') + + +# decimal number +number = int(input("Enter any decimal number: ")) + +decimalToBinary(number) diff --git a/Python/program-19/readme.md b/Python/program-19/readme.md new file mode 100644 index 00000000..28cc94e5 --- /dev/null +++ b/Python/program-19/readme.md @@ -0,0 +1 @@ +Program to convert Binary to Decimal diff --git a/readme.md b/readme.md index a635edd2..0a5ec0fd 100644 --- a/readme.md +++ b/readme.md @@ -3,7 +3,7 @@ -## This repo is an awesome collection of basic programs in different programming languages⚡ +## This Repository is an awesome collection of basic programs in different programming languages⚡
@@ -16,6 +16,7 @@ ## ⚠️Points to note before you start contributing - Check whether the program you are going to add already exists in the repo or not. Make sure you're not repeting any program. +- Do add readme.md file for explaining the question , input and output for each program. - Please go through [How to contribute](#contribute) and do accordingly to make a smooth contribution.