Skip to content

Instantly share code, notes, and snippets.

View jeevisathya's full-sized avatar
🏠
Working from home

Jeevitha S jeevisathya

🏠
Working from home
  • Excelacom technologies
  • chennai
View GitHub Profile
@jeevisathya
jeevisathya / Reverse word.c
Created November 10, 2020 08:35
Reverse string
sample i/p: welcome to india
o/p: india to welcome
#include<stdio.h>
#include<string.h>
int main() {
int l,s,e,i;
char str[1002];
scanf("%[^\n]s", &str);
sample i/p: alpha
o/p: lph
#include <stdio.h>
#include <string.h>
int main() {
int i,j,k,flag=0,flag1=0,l,co=0;
char s[1002];
scanf("%s", s);
l=strlen(s);
sample i/p:
10
3 4 5 3 4 5 1 1 1 0
o/p: 1 1 1 3 3 4 4 5 5 0
#include <stdio.h>
int main() {
int n,i,j,co,a[1002],ans[1002]={0},k;
scanf("%d", &n);
for(i=0; i<n; i++)
@jeevisathya
jeevisathya / 8 cells problem.c
Created November 4, 2020 07:06
8 cells problem
sample i/p:
1 0 1 0 1 0 1 1
3
o/p:
0 0 0 0 0 0 0 1
#include <stdio.h>
int main() {
int d,i,j,ans[1002],a[1002];
for(i=1; i<=8; i++){
sample i/p: 3 3
1 2 3
4 5 6
7 8 9
o/p: 3 6 9
2 5 8
1 4 7
#include <stdio.h>
sample i/p: 3 3
1 2 3
4 5 6
7 8 9
o/p: 7 4 1
8 5 2
9 6 3
#include <stdio.h>
sample i/p:19807600
o/p:10006789
#include <stdio.h>
int main() {
int n,t,i,ans=0,r,z=1;
scanf("%d", &n);
t=n;
while(n){
sample i/p:(()())
o/p:3 // balanced count
sample i/p:))()()
o/p:-1
#include <stdio.h>
#include <string.h>
int main() {
sample i/p: 5 10 15
o/p: 5
sample i/p: 12 24 36
o/p: 12
#include <stdio.h>
int main() {
int a,b,c,i,ans;
scanf("%d %d %d", &a,&b,&c);
if(a>=b && a>=c){
@jeevisathya
jeevisathya / Second maximum.c
Created October 29, 2020 15:06
Second maximum
sample i/p: 4
3 4 2 1
o/p: 3 --> second maximum...
#include <stdio.h>
int main() {
int n,arr[102],i,max=0,sm;
scanf("%d", &n);
for(i=0; i<n; i++)
scanf("%d ", &arr[i]);