Skip to content

Instantly share code, notes, and snippets.

View suryansh011's full-sized avatar

Suryansh Singh suryansh011

View GitHub Profile
/*
*
* Title: Finding the Armstrong Number
* By: Suryansh Singh Shishodia
* Github: https://github.com/elekktron
*
*/
#include <stdio.h>
#include <math.h>
@suryansh011
suryansh011 / pattern1.c
Last active May 31, 2021 16:03
Pattern in C
/*
* 1 2 3 4 5 6 7 8 9 <------ x (i)
* 1 * * * * * * * * *
* 2 * * * * * * * *
* 3 * * * * * *
* 4 * * * *
* 5 * *
* ^
* |
* |
@suryansh011
suryansh011 / nginx
Created August 30, 2021 12:00 — forked from d-bo/nginx
nginx rc.d init script freebsd
#!/bin/sh
# if compiled from sources
# place this file inside /usr/local/etc/rc.d
# point _pidfrefix where nginx holds pid file
. /etc/rc.subr
name="nginx"
rcvar=nginx_enable
@suryansh011
suryansh011 / nginx.conf
Created August 30, 2021 12:19
Nginx configuration with per user web directory
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@suryansh011
suryansh011 / reverse_array.c
Created September 9, 2021 16:56
Reverse Array in C
#include <stdio.h>
int main() {
int num, i;
scanf("%d", &num);
int array[num];
for (i = 0; i < num; i++) {
scanf("%d", &array[i]);
}
#include <stdio.h>
int main() {
int x1, x2, v1, v2, i = 0, flag = 0;
scanf("%d%d%d%d", &x1, &v1, &x2, &v2);
for (i = 0; i < 10000; i++) {
if ((x1 + i*v1) == (x2 + i*v2)) {
flag = 1;
break;
#include <stdio.h>
int main() {
int m, n, i, out;
scanf("%d", &m);
int arr[m];
for(i = 0; i < m; i++)
scanf("%d", &arr[i]);
scanf("%d", &n);
#include <stdio.h>
int main()
{
int i, count = 0, low, high, mid, n, key, array[100];
scanf("%d",&n);
for(i = 0; i < n; i++)
scanf("%d",&array[i]);
scanf("%d", &key);
low = 0;
high = n - 1;
@suryansh011
suryansh011 / pure_selection_sort.c
Created October 1, 2021 16:23
Pure Selection Sort in C
/* Selection Sort Algorithm */
#include <stdio.h>
int main() {
int i, j;
int min, temp;
int c = 0, s = 0;
int n;
@suryansh011
suryansh011 / simple_quick_sort.c
Created October 1, 2021 18:18
Simple Quick Sort
include <stdio.h>
int partition(int s[], int l, int h) {
int i, p, firsthigh, temp;
p = h;
firsthigh = l;
for (i = l; i < h; i++) {
if (s[i] < s[p]) {
temp = s[i];