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
sample i/p:5
o/p:ABCDEFGHIJ
ABCDEFGHI
ABCDEFGH
ABCDEFG
ABCDEF
#include <stdio.h>
#include <string.h>
int main()
@jeevisathya
jeevisathya / string.c
Created October 5, 2020 07:04
string
sample i/p:aaabccd
o/p:a3b1c2d1
//Code by using two friends algorithm...
#include <stdio.h>
#include <string.h>
int main()
{
int f=0,s=0,co=0;
sample i/p:3 3
1 4 7
2 5 8 -> convert transpose and then multiply
3 6 9
o/p:66 78 90
78 93 108
90 108 126
#include <stdio.h>
int main(){
sample i/p: 4
o/p: 4444
4414
4424
4434
4444
#include <stdio.h>
int main()
{
sample i/p: 3
o/p: **0
*00
0*0
*00
**0
#include <stdio.h>
int main()
{
@jeevisathya
jeevisathya / Subset of array.c
Created October 2, 2020 08:46
Subset array
sample i/p: 5
1 2 5 9 4
6
o/p: 1 1 0 0 0 0 0
1 1 1 1 0 0 0
1 1 1 1 0 1 1
1 1 1 1 0 1 1
1 1 1 1 1 1 1
subset array
sample o/p:8 6 4
// Even numbers in an integer...
#include <stdio.h>
void func(int n){
if(n==0){
return 0;
}else{
int r=n%10;
if(r%2==0){
sample i/p:213
o/p: 6 //sum of the digits in recursively
#include <stdio.h>
int func(int n){
if(n==0){
return 0;
}else{
return (n%10)+func(n/10);
}
sample i/p: 3 2 1 1 2 1 1
#include <stdio.h>
int func(int n){
if(n>0){
printf("%d ", n);
func(n-1); //same function calling process...
func(n-1);
}
}
sample o/p: 6
#include <stdio.h>
int func(int n){
if(n>0){
return func(n-1)+n; //It takes reverse order as recursively...
}else{
return 0;
}
}