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

Introduced and added HCF.c, LCM.c and prime.c #114

Open
wants to merge 1 commit into
base: master
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
14 changes: 14 additions & 0 deletions C/HCF.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include<stdio.h>
int main(){
int a,b,i;
printf("Enter a");
scanf("%d", &a);
printf("Enter b");
scanf("%d", &b);
for(i=(a>b?b:a);i>1;i--){
if(a%i==0 && b%i==0){
printf("HCF is %d",i);
break;
}
}
}
14 changes: 14 additions & 0 deletions C/LCM.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include<stdio.h>
int main() {
int a, b,i;
printf("Enter a");
scanf("%d",&a);
printf("Enter b");
scanf("%d",&b);
for(i=(a>b?a:b);i<=(a*b);i=i+(a>b?a:b)){
if(i%a==0 && i%b==0){
break;
}
}
printf("LCM is %d", i);
}
19 changes: 19 additions & 0 deletions C/prime.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include<stdio.h>
int main(){
int number,i,flag=0;
printf("Ener the number you want to check");
scanf("%d",&number);
for(i=2;i<number;i++){
if(number%i==0){
flag=1;
}
}
if(flag!=1){
printf("%d is a prime number",number);
}
else
{
printf("Not a prime number");
}

}
3 changes: 3 additions & 0 deletions introduce-yourself/Jayant-saksham.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Hi there, my name is Jayant Saksham.
I am a second year student at Delhi Technological University (DTU). I am a flutter developer and this is my first open source contribution.
Hope to learn something new from here