Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
84977cb
Added program for kaprekar number
sajidmansoori12 Sep 30, 2020
a69401e
Added program for kaprekar number
sajidmansoori12 Sep 30, 2020
3a0002e
Created MinMax
jainvaidehi Sep 30, 2020
7b7ad2e
Created README
jainvaidehi Sep 30, 2020
eb6ce96
Created program.c
shreetanu Sep 30, 2020
3516c44
Created Readme.md
shreetanu Sep 30, 2020
4500f8c
Update Readme.md
shreetanu Sep 30, 2020
4572cfb
Created program
jainvaidehi Sep 30, 2020
3f83d6e
Created README
jainvaidehi Sep 30, 2020
c69856b
Create program.c
shreetanu Sep 30, 2020
3ea790d
Create Readme.md
shreetanu Sep 30, 2020
47eed1d
Created program
jainvaidehi Sep 30, 2020
80a5873
Created README
jainvaidehi Sep 30, 2020
ee3f4fb
Create program.c
shreetanu Sep 30, 2020
64fe9d8
Created program
jainvaidehi Sep 30, 2020
acf8e04
Created README
jainvaidehi Sep 30, 2020
3927675
Create program.c
shreetanu Sep 30, 2020
ea5fdeb
Create Readme.md
shreetanu Sep 30, 2020
881fab4
Add program-55
claudiojpaz Oct 1, 2020
3bce936
Update program.c
aaarif796 Oct 1, 2020
70e4415
Delete a.out
aaarif796 Oct 1, 2020
5797178
Create readme.txt
aaarif796 Oct 1, 2020
b451c34
Merge pull request #69 from sajidmansoori12/kaprekar
swaaz Oct 1, 2020
9631ce2
Merge pull request #88 from swaaz/hacktoberfest
swaaz Oct 1, 2020
f34bd9a
Merge pull request #71 from jainvaidehi/Branch-1
swaaz Oct 1, 2020
72e5298
Merge pull request #73 from shreetanu/branchT-1
swaaz Oct 1, 2020
5cbd1c1
Merge pull request #74 from jainvaidehi/BranchVV-1
swaaz Oct 1, 2020
c6cea93
Merge pull request #75 from shreetanu/branchT-2
swaaz Oct 1, 2020
6bcdc54
Merge pull request #76 from jainvaidehi/Branch-VV-2
swaaz Oct 1, 2020
e391f38
Add files via upload
Arceus-sj Oct 1, 2020
40dd6ac
Create Readme.md
Arceus-sj Oct 1, 2020
9a91028
Rename C++/Readme.md to C++/Program-2/Readme.md
Arceus-sj Oct 1, 2020
7751e09
Rename C++/number_of_occurrence.cpp to C++/Program-2/number_of_occurr…
Arceus-sj Oct 1, 2020
edee3fd
Merge pull request #90 from swaaz/hacktoberfest
swaaz Oct 1, 2020
35c74a7
Merge pull request #78 from shreetanu/branchT-3
swaaz Oct 1, 2020
9ba9f9d
Merge pull request #79 from jainvaidehi/Branch-VV3
swaaz Oct 1, 2020
426b644
Merge pull request #81 from shreetanu/branchT-4
swaaz Oct 1, 2020
0291b9d
Merge pull request #91 from swaaz/hacktoberfest
swaaz Oct 1, 2020
4ba2b5d
Create swap_kth_Element.cpp
Arceus-sj Oct 1, 2020
56aabbf
Create Readme.md
Arceus-sj Oct 1, 2020
532e706
Merge pull request #82 from claudiojpaz/32bits-binary
swaaz Oct 1, 2020
92ba9ab
Merge pull request #85 from aaarif796/master
swaaz Oct 1, 2020
eb99810
Added sorting algorithm
Oct 1, 2020
e924e06
Merge pull request #93 from swaaz/hacktoberfest
swaaz Oct 1, 2020
6ac10f9
Merge pull request #89 from Arceus-sj/master
swaaz Oct 1, 2020
d9c3234
Merge pull request #92 from weeeihan/master
swaaz Oct 1, 2020
b9dc71b
Merge pull request #95 from swaaz/master
swaaz Oct 1, 2020
24bc54d
added folder structure
swaaz Oct 1, 2020
16e6c90
Merge pull request #98 from swaaz/swaaz
swaaz Oct 1, 2020
addd1fc
Update readme.md
swaaz Oct 1, 2020
6d35b3e
Update contribution.md
swaaz Oct 1, 2020
94ffc54
Merge pull request #99 from swaaz/swaaz
swaaz Oct 1, 2020
50a209f
Write a program in C to calculate the grade example
Oct 1, 2020
6466ad0
Merge pull request #100 from tanut2539/develop
swaaz Oct 1, 2020
049ec89
Merge pull request #1 from swaaz/master
redfedted Oct 2, 2020
cd177c3
Added 2 c programs
redfedted Oct 2, 2020
0853887
Update README.md
redfedted Oct 2, 2020
6001594
Rename readme.txt to readme.md
swaaz Oct 2, 2020
1c6ac4e
Merge pull request #2 from redfedted/updates
redfedted Oct 2, 2020
6b0bb07
Updated Readme in C and seperated the programs
redfedted Oct 2, 2020
87d4694
Merge branch 'hacktoberfest' into master
swaaz Oct 2, 2020
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
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/contribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
eg-git push origin -u swaaz
- The given link should be copied and pasted in web browser or go to your repo in web browser
- Create a pull request
- tag @swaaz under review section
## If you are contributing for the first time,then :
[click here](https://gitme.js.org/)

23 changes: 23 additions & 0 deletions C++/Program -1/Program.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <iostream>
using namespace std;
#include<bits/stdc++.h>
int main() {
cout<<"Enter the number of elements "<<endl;
int n;
cin>>n;//Input the size of array
int arr[n];
int min=INT_MAX;
int max=INT_MIN;
cout<<"Enter the elements"<<endl;
for(int i=0;i<n;++i)//Input the elements of array
{
cin>>arr[i];
if(arr[i]<min)//if current element is less than min
min=arr[i];//min is updated
if(arr[i]>max)//if current element is greater than max
max=arr[i];//max is updated
}
cout<<"Minimum element is:"<<min<<endl;
cout<<"Maximum element is:"<<max<<endl;
return 0;
}
9 changes: 9 additions & 0 deletions C++/Program -1/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Program 1

Write a program to find the maximum and minimum element in an array.

Variable description--
n=Number of elements in an array
arr=Array of size n
min= Holds the minimum element
max=Holds the maximum element
7 changes: 7 additions & 0 deletions C++/Program-2/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Program 2:

Write a Program to find the number of occurrence of X element present in sorted array.
Variable description-->
n = size of array/ number of element
x = Element to be counted in array
count = veriable to count the X-number in array
42 changes: 42 additions & 0 deletions C++/Program-2/number_of_occurrence.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include<bits/stdc++.h>

using namespace std;

class Solution{
public:

/*
if x is present in arr[] then returns the count
of occurrences of x, otherwise returns 0.
*/

int count(int arr[], int n, int x) {

int count = 0;
for(int i=0;i<n;i++){
if(arr[i] == x){
count++;
}
}
return count;
}
};



int main() {

int n, x;
cout<<"Enter the size of an Array: ";
cin >> n ;
cout<<"Enter a number to be counted: ";
cin>>x;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
Solution ob;
auto ans = ob.count(arr, n, x);
cout<< "number "<<x<<" counted in array for " << ans <<" times."<< "\n";
return 0;
}
4 changes: 4 additions & 0 deletions C++/Program-3/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Program to Swap the Kth Elements of a series.
variable description -->
n = number of elements/size
k = Kth element for swaping
45 changes: 45 additions & 0 deletions C++/Program-3/swap_kth_Element.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include<iostream>

using namespace std ;

void takeInput(int a[], int n){
for(int i=1;i<=n;i++){
cin>>a[i];
}
}

void swap_k(int a[], int n, int k){

int i , count = n ;
for(i=1 ; i<=n , count >= 1 ; i++ , count--){

if(k == i || k == count){
swap(a[k],a[count]);
}

}

for(i=1;i<=n;i++){
cout<<a[i]<<" " ;
}
}

int main()
{

int n;
cout<<"Enter size of an Array:";
cin>>n ;

int k;
cout<<"Enter Kth element to swap:";
cin>>k ;

int a[1000];
takeInput(a,n);

swap_k(a,n,k);
cout<<"\n";

return 0;
}
8 changes: 8 additions & 0 deletions C/Program-49/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Program 49

Write a program to find the sum of the digits of the given number.

Variable description--
num=Number
sum= Holds the sum
dig=Holds the single digit of the number
18 changes: 18 additions & 0 deletions C/Program-49/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <stdio.h>

int main() {

int n;
printf("Enter the number");
int num;
scanf("%d",&num);//Enter the number
int sum=0,dig=0;
while(num>0)
{
dig=num%10;
sum+=dig;
num/=10;
}
printf("The sum of digits of a number is: %d",sum);
return 0;
}
4 changes: 4 additions & 0 deletions C/Program-52/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Program 52

Write a program to find whether the given element is present in the array or not.

39 changes: 39 additions & 0 deletions C/Program-52/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <stdio.h>

int main() {
int n;//number of elements of array;
printf("Enter the number of elements");
scanf("%d",&n);
int arr[n];
printf("\nEnter the elements");
for(int i=0;i<n;i++)
scanf("%d",&arr[i]);
int x;
printf("\nEnter the key to search");
scanf("%d",&x);
int l=0,r=n-1,m=0;
int f=1;
while (l <= r)
{
m = l + (r - l) / 2;

// Check if x is present at mid
if (arr[m] == x)
{
printf("\nElement found");
f=0;
break;
}

// If x greater, ignore left half
if (arr[m] < x)
l = m + 1;

// If x is smaller, ignore right half
else
r = m - 1;
}
if(f==1)
printf("\nElement not found");
return 0;
}
17 changes: 15 additions & 2 deletions C/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,20 @@
| Program-44 | Program for implementation of the approach |
| Program-45 | Program to illustrate the above given pattern of numbers. |
| Program-46 | Program to convert binary number to decimal |
| Program-47 | Program to generate strong password |

| Program-47 | Program to find the maximum and minimum element in an array|
| Program-48 | Program to check if a number is even or odd |
| Program-49 | Program to find the sum of the digits of the given number |
| Program-50 | Program to check whether a given number is a palindrome or not |
| Program-51 | Program to print duplicates in an array |
| Program-52 | to find whether the given element is present in the array or not |
| Program-53 | Program to find the position of an element in an array |
| Program-54 | Program to check whether two strings are anagrams or not |
| Program-55 | Program to print print a number in binary |
| Program-56 | Program to calculate the number of vowels and consonants in a string |
| Program-57 | Program to calculate the grade |
| 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 |



8 changes: 4 additions & 4 deletions C/program-2/program.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ return 1;
int main() /*main function */
{
int n;
printf("enter the number");
printf("Enter the number:");
scanf("%d",&n);
if(isprime(n)==0)
{
printf(" not prime");
printf("%d is not prime number.",n);
}
else if(isprime(n)==1)
{
printf("prime");
printf("%d is a prime number.",n);
}
return 0;
}
}
6 changes: 6 additions & 0 deletions C/program-25/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This program is to print the number of *. Example if user enter 5. Then it'll print
*
**
***
****
*****
13 changes: 13 additions & 0 deletions C/program-47/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Program 47

Write a program to find the maximum and minimum element in an array.

Variable description--

n=Number of elements in an array

a=Array of size N

min= Holds the minimum element

max=Holds the maximum element
23 changes: 23 additions & 0 deletions C/program-47/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <stdio.h>
int main()
{

int a[100],n,min,max;
printf("enter the size of the array");
scanf("%d",&n);
printf("enter the elements of the array");
for(int i=0;i<n;++i)
scanf("%d",&a[i]);
//Assuming the first element of the array to be minimum and maximum
min=a[0];
max=a[0];
for(int i=1;i<n;++i)
{
if(a[i]>max)
max=a[i];
if(a[i]<min)
min=a[i];
}
printf("The minimum element is %d\n",min);
printf("The maximum element is %d",max);
}
13 changes: 13 additions & 0 deletions C/program-50/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Program 50

Write a program to check whether a given number is a palindrome or not.

Variable description--

n=Holds the element which is to be checked

temp=Holds the copy of the element

rev= Holds the reverse of the number

rem=Holds the digits of the number
19 changes: 19 additions & 0 deletions C/program-50/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include<stdio.h>
int main()
{
int rem,rev=0,temp,n;
printf("Enter the number");
scanf("%d",&n);
temp=n;
while(n>0)
{
rem=n%10;
n=n/10;
rev=rem+(rev*10);
}
if(temp==rev)
printf("number is palindrome");
else
printf("number is not palindrome");
return 0;
}
1 change: 1 addition & 0 deletions C/program-53/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Program to find the position of an element in an array
22 changes: 22 additions & 0 deletions C/program-53/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include<stdio.h>
int main()
{
int a[100],n,el,i;
printf("Enter the size of the array");
scanf("%d",&n);
printf("Enter the elements of the array");
for(int i=0;i<n;++i)
scanf("%d",&a[i]);
printf("Enter the element to be searched");
scanf("%d",&el);
for(i=0;i<n;++i)
{
if(el==a[i])
break;
}
if(i==n)
printf("element not found in the array");
else
printf("element found at %d",i+1);
return 0;
}
3 changes: 3 additions & 0 deletions C/program-54/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
A program in C which checks whether two strings are anagrams or not

An anagram of a string is another string that contains same characters, only the order of characters can be different.
Loading