diff --git a/C++/Program-20/README.md b/C++/Program-20/README.md new file mode 100644 index 00000000..6a94fd2d --- /dev/null +++ b/C++/Program-20/README.md @@ -0,0 +1,4 @@ +## To find the square root of a number upto "p" no of places + + +Here we take input of that number "num" and the number "p" diff --git a/C++/Program-20/program.cpp b/C++/Program-20/program.cpp new file mode 100644 index 00000000..53f78f47 --- /dev/null +++ b/C++/Program-20/program.cpp @@ -0,0 +1,45 @@ +#include +using namespace std; + + +float square_root(int num,int p) { + int s=0; + int e=num; + float ans=-1; + while(s<=e) { + int mid=s+e>>1; // (s+e)/2 + if(mid*mid==num) { + return mid; + } + else if(mid*mid>=num) { + e=mid-1; + + } + else { //as 7*7 is vey close to 50 + s=mid+1; + ans=mid; + } + } + + //for floating part + //brute force + float inc=0.1; + for(int i=1;i<=p;i++) { + while(ans*ans<=num) { + ans=ans+inc; + } + //when this blows up + ans=ans-inc;//comeback 1 step + inc/=10; + } + return ans; + +} + +int main() { + int num,p; + cin>>num;///the input number of which you want to find the square root + cin>>p;//find the square root upto "p" no of places + cout< + +using namespace std; + +void printSeries(int num1,int num2){ + int count = 1; + int i = 1; + while(count < num1+1){ + int num = (3 * i) + 2; + i++; + + if((num % num2) == 0){ + + }else{ + cout<>num1>>num2; + printSeries(num1,num2); + return 0; +} diff --git a/C++/Program18/Readme.md b/C++/Program18/Readme.md new file mode 100644 index 00000000..9118f569 --- /dev/null +++ b/C++/Program18/Readme.md @@ -0,0 +1,33 @@ +## Problem + +```bash +Write a function which prints first num1 terms of the series 3n+2 which are not multiples of num2. +``` + +## Take Input +```bash +Number 1(num1) +Number 2(num2) +0 < num1 < 100 & 0 < num2 < 100 +``` + +## Sample Input + +```bash +num1 = 10; +num2 = 4; +``` +## Sample Output + +```bash +5 +11 +14 +17 +23 +26 +29 +35 +38 +41 +``` diff --git a/C++/README.md b/C++/README.md index 6c2a8fec..4ffbcb51 100644 --- a/C++/README.md +++ b/C++/README.md @@ -15,3 +15,4 @@ | Program-10 | Program to find the missing number in a Sorted Array. | Program-15 | Program to find modular exponentiation. +| Program-19| To check whether a number is in palindrome or not \ No newline at end of file diff --git a/C++/program-19/Read me.md b/C++/program-19/Read me.md new file mode 100644 index 00000000..a952e91a --- /dev/null +++ b/C++/program-19/Read me.md @@ -0,0 +1 @@ +# To check whether a number is in palindrome or not \ No newline at end of file diff --git a/C++/program-19/palindrome.cpp b/C++/program-19/palindrome.cpp new file mode 100644 index 00000000..a18f2dd0 --- /dev/null +++ b/C++/program-19/palindrome.cpp @@ -0,0 +1,23 @@ +#include +using namespace std; +int main() +{ + int num, temp, digit, rev = 0; + + cout << "Enter a positive number: "; + cin >> num; + temp = num; + while (num != 0){ + digit = num % 10; + rev = (rev * 10) + digit; + num = num / 10; + } + cout << "The reverse of the number is: " << rev << endl; + if (temp == rev){ + cout<<"The number is a palindrome."; + } + else{ + cout << "The number is not a palindrome."; + } + return 0; +} diff --git a/Dart/Program1/README.md b/Dart/Program1/README.md new file mode 100644 index 00000000..9d3d8f2b --- /dev/null +++ b/Dart/Program1/README.md @@ -0,0 +1,3 @@ +Q1. Write a program to check given number is even or odd. + +Ask the number from user in variable "number" diff --git a/Dart/Program1/checkevenodd.dart b/Dart/Program1/checkevenodd.dart new file mode 100644 index 00000000..0259ae75 --- /dev/null +++ b/Dart/Program1/checkevenodd.dart @@ -0,0 +1,14 @@ +import 'dart:io'; + +void main() { + int number; + + print("Enter a number : "); + number = int.parse(stdin.readLineSync()); + + if (number.isEven) { + print("$number is an even number"); + } else if (number.isOdd) { + print("$number is an odd number"); + } +} \ No newline at end of file diff --git a/Python/README.md b/Python/README.md index c1b29aee..b171790f 100644 --- a/Python/README.md +++ b/Python/README.md @@ -21,4 +21,15 @@ | Program-17 | Program to convert Binary to Decimal. | | Program-18 | Program to check leap year or not. | | Program-19 | Program to count number of integers between 1 to 50 divisible by a number. | -| Program-20 | Program to create an array of range specified and print. | \ No newline at end of file +| Program-20 | Program to create an array of range specified and print. | +| Program-21 | Program to print the number of *. | +| Program-22 | Program to check if a number is even or odd | +| Program-23 | Program to find the all the prime numbers between the given range. | +| Program-24 | Program to convert binary number to decimal | +| Program-25 | Program of a car game which shows if the car has started or stopped | +| Program-26 | Program of a guessing game in which u guess the secret number with a guessing limit of 3 attempts. | +| Program-27 | Program which tells you the of downpayment of the house is 10% or 20% +depending if the owner has a good credit or not.The price of the house is to be entered in the output | +| Program-28 | Program to find out the GCD of any 2 given numbers | +| Program-29 | Program which will display the fibonacci series | +| Program-31 | Program to print Amstrong numbers | diff --git a/readme.md b/readme.md index 0a5ec0fd..32191b66 100644 --- a/readme.md +++ b/readme.md @@ -115,5 +115,5 @@ ### Tada you just made a contribution โœจ. Pat your back ๐Ÿ‘

-### If you have never made a PR before ๐Ÿ˜•, no worries, follow these steps to get going [๐Ÿ‘‰click me](https://gitme.js.org/) +### If you have never made a PR before ๐Ÿ˜•, no worries, follow these steps to get going [๐Ÿ‘‰click me](https://gitgo.swaaz.me/)