-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
72 changed files
with
618 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include<stdio.h> | ||
int main() | ||
{ | ||
int a,b; | ||
scanf("%d %d",&a,&b); | ||
int mns=a-b; | ||
if(mns>=0) | ||
{ | ||
printf("%d",mns); | ||
} | ||
else | ||
{ | ||
printf("0"); | ||
} | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include<stdio.h> | ||
int main() | ||
{ | ||
int n; | ||
scanf("%d",&n); | ||
if(n==1) | ||
{ | ||
printf("-1\n"); | ||
} | ||
else | ||
{ | ||
for(int i=1;i<=n;i=i+1) | ||
{ | ||
if (i%2==0) | ||
{ | ||
printf("%d\n",i); | ||
} | ||
} | ||
|
||
} | ||
return 0; | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include<stdio.h> | ||
int main() | ||
{ | ||
int n; | ||
scanf("%d",&n); | ||
int a; | ||
int even=0,odd=0,pos=0,neg=0; | ||
for(int i=1;i<=n;i=i+1) | ||
{ | ||
scanf("%d",&a); | ||
if(a%2==0) | ||
{ | ||
// even | ||
even++; | ||
} | ||
else | ||
{ | ||
//odd | ||
odd++; | ||
} | ||
|
||
if(a>0) | ||
{ | ||
// positive | ||
pos++; | ||
} | ||
else if(a<0) | ||
{ | ||
// neg | ||
neg++; | ||
} | ||
} | ||
printf("Even: %d\nOdd: %d\nPositive: %d\nNegative: %d",even,odd,pos,neg); | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include<stdio.h> | ||
int main() | ||
{ | ||
char n; | ||
scanf("%c",&n); | ||
if(n==122) | ||
{ | ||
printf("%c",97); | ||
} | ||
else | ||
{ | ||
printf("%c",n+1); | ||
} | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include<stdio.h> | ||
int main() | ||
{ | ||
int a,b,c,d; | ||
scanf("%d %d %d %d",&a,&b,&c,&d); | ||
if(a+b*c==d) | ||
{ | ||
printf("YES\n"); | ||
} | ||
else if(a*b+c==d) | ||
{ | ||
printf("YES\n"); | ||
} | ||
else if(a-b+c==d) | ||
{ | ||
printf("YES\n"); | ||
} | ||
|
||
else if(a-b*c==d) | ||
{ | ||
printf("YES\n"); | ||
} | ||
else if(a+b-c==d) | ||
{ | ||
printf("YES\n"); | ||
} | ||
|
||
else if(a*b-c==d) | ||
{ | ||
printf("YES\n"); | ||
} | ||
else | ||
{ | ||
printf("NO\n"); | ||
} | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include<stdio.h> | ||
int main() | ||
{ | ||
int x; | ||
while(scanf("%d",&x)!=EOF) | ||
{ | ||
if(x==1999) | ||
{ | ||
printf("Correct\n"); | ||
break; | ||
} | ||
else | ||
{ | ||
printf("Wrong\n"); | ||
} | ||
} | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include<stdio.h> | ||
int main() | ||
{ | ||
int n; | ||
scanf("%d",&n); | ||
int max=0; | ||
for(int i=1;i<=n;i=i+1) | ||
{ | ||
int a; | ||
scanf("%d",&a); | ||
if(a>max) | ||
{ | ||
max=a; | ||
} | ||
} | ||
printf("%d\n",max); | ||
return 0; | ||
} | ||
|
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include<stdio.h> | ||
int main() | ||
{ | ||
int n,i; | ||
scanf("%d",&n); | ||
for(i=1;i<=12;i++) | ||
{ | ||
printf("%d * %d = %d\n",n,i,n*i); | ||
} | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// #include<stdio.h> | ||
// int main() | ||
// { | ||
// long long int n,m,k,ans=0; | ||
|
||
// scanf("%lld %lld %lld", &n,&m,&k); | ||
|
||
// long long int min; | ||
// if(n<=m && n<=k) | ||
// { | ||
// min=n; | ||
// } | ||
// else if (m<=n && m<=k) | ||
// { | ||
// min=m; | ||
// } | ||
// else | ||
// { | ||
// min=k; | ||
// } | ||
// ans+=min; | ||
// n-=min; | ||
// m-=min; | ||
// k-=min; | ||
|
||
// n=n/2; | ||
// if(n<k) | ||
// { | ||
// ans+=n; | ||
// } | ||
// else | ||
// { | ||
// ans+=k; | ||
// } | ||
|
||
// printf("%lld\n",ans); | ||
// return 0; | ||
// } | ||
|
||
#include <stdio.h> | ||
#include <string.h> | ||
#include <math.h> | ||
#include <stdlib.h> | ||
|
||
int main() { | ||
int n,v; | ||
scanf("%d",&n); | ||
int even_ans=0; int odd_ans=0; | ||
for(int i=0;i<=n;i++) | ||
{ | ||
scanf("%d",&v); | ||
if(v%2==0) | ||
{ | ||
even_ans=even_ans+v; | ||
} | ||
else | ||
{ | ||
odd_ans=odd_ans+v; | ||
} | ||
} | ||
printf("%d %d",even_ans, odd_ans); | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include<stdio.h> | ||
int main() | ||
{ | ||
int n; | ||
scanf("%d",&n); | ||
int mod=n%10; | ||
int dvd=n/10; | ||
if(mod%dvd==0) | ||
{ | ||
printf("YES"); | ||
} | ||
else if(dvd%mod==0) | ||
{ | ||
printf("YES"); | ||
} | ||
else | ||
{ | ||
printf("NO"); | ||
} | ||
|
||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include<stdio.h> | ||
int main() | ||
{ | ||
int n; | ||
scanf("%d",&n); | ||
for(int i=1;i<=n;i++) | ||
{ | ||
if(n%i==0) | ||
{ | ||
printf("%d\n",i); | ||
} | ||
} | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// #include<stdio.h> | ||
// int main() | ||
// { | ||
// int a; | ||
// scanf("%d",&a); | ||
// while(a!=0) | ||
// { | ||
// printf("%d ",a%10); | ||
// a=a/10; | ||
// } | ||
// return 0; | ||
// } | ||
|
||
#include<stdio.h> | ||
int main() | ||
{ | ||
int a; | ||
scanf("%d",&a); | ||
while(a!=0) | ||
{ | ||
printf("%d ",a%10); | ||
a=a/10; | ||
} | ||
return 0; | ||
} |
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <stdio.h> | ||
int main() | ||
{ | ||
int N; | ||
scanf("%d", &N); | ||
int A[N]; | ||
|
||
for (int i = 0; i < N; i++) | ||
{ | ||
scanf("%d", &A[i]); | ||
} | ||
long long int sum = 0; | ||
for (int i = 0; i < N; i++) | ||
{ | ||
sum = sum + A[i]; | ||
} | ||
if(sum<0) | ||
{ | ||
printf("%lld", sum * -1); | ||
} | ||
else | ||
{ | ||
printf("%lld",sum); | ||
} | ||
return 0; | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include<stdio.h> | ||
int main() | ||
{ | ||
int N; | ||
scanf("%d",&N); | ||
int A[N]; | ||
for(int i=0;i<N;i++) | ||
{ | ||
scanf("%d",&A[i]); | ||
} | ||
int X; | ||
scanf("%d",&X); | ||
int ans=-1; | ||
int i; | ||
for(int i=0;i<N;i++) | ||
{ | ||
if(X==A[i]) | ||
{ | ||
ans=i; | ||
break; | ||
} | ||
} | ||
printf("%d",ans); | ||
|
||
return 0; | ||
} |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.