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
#include <stdio.h> | |
int spc[5][5]={{1,0,0,0,0},{1,1,0,0,0},{0,1,1,0,0},{0,0,0,0,0},{0,0,1,1,1}}; | |
int rs=5,cs=5; | |
int main(){ | |
int i; | |
int rc[2]; | |
printArr(spc,rs,cs); | |
printf("Enter the row number and column number\n"); | |
for(i=0;i<2;i++){ | |
scanf("%d",&rc[i]); |
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
#include <stdio.h> | |
void main(){ | |
int i = 0,sum=0; | |
for(i=1;i<1000;i++){ | |
if(i%3==0 | i%5==0){ | |
sum += i; | |
} | |
} | |
printf("%d\n",sum); | |
} |
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
#include <stdio.h> | |
void main(){ | |
int a=1,b=1,c=2,i,sum=0; | |
for(i=0;i<50000;i++){ | |
c=a+b; | |
a=b; | |
b=c; | |
if(c>4000000){ | |
break; |
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
#include <stdio.h> | |
#include <math.h> | |
typedef int bool; | |
#define true 1 | |
#define false 0 | |
void main(){ | |
long long int i,n=600851475143; | |
for(i=1;i<(int)sqrt(n)+1;i++){ | |
if(n%i==0 && prime(i)==1){ | |
printf("%d\n",i); |
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
typedef int bool; | |
#define true 1 | |
#define false 0 | |
bool prime(long long int n){ | |
long long int i; | |
if(n<=0 || n==1 || (n%2==0 && n!=2)){ | |
return false; | |
} | |
else if(n==2 || n==3){ | |
return true; |
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
int length(char * array){ | |
int len=0,i=0; | |
while(1){ | |
if(array[i]=='\0') return len; | |
len++; | |
i++; | |
} | |
} |
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
void reverse(char * array,int size){ | |
int i; | |
char a,b; | |
for(i=0;i<=size/2;i++){ | |
a = array[i]; | |
array[i] = array[size-i-1]; | |
array[size-i-1] = a; | |
} | |
} |
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
#include <stdio.h> | |
typedef int bool; | |
#define true 1 | |
#define false 0 | |
void main(){ | |
char a[7]; | |
int i,j,p,m=100; | |
for(i=100;i<1000;i++){ | |
for(j=100;j<1000;j++){ | |
p = i*j; |
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
int gcd(int a,int b){ | |
if (a>b){ | |
if(b==0){ | |
return a; | |
} | |
else{ | |
return gcd(b,a%b); | |
} | |
} | |
else{ |
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
#include <stdio.h> | |
typedef int bool; | |
#define true 1 | |
#define false 0 | |
void main(){ | |
long long int i,p=1,t,t2; | |
for(i=2;i<=20;i++){ | |
p = (p*i)/gcd(p,i); | |
} |
OlderNewer