Skip to content

Instantly share code, notes, and snippets.

View SohanChy's full-sized avatar

Sohan Chowdhury SohanChy

View GitHub Profile
@SohanChy
SohanChy / Simple Upside Down Pyramid Star Printing in C.c
Last active August 29, 2015 14:23
Simple Upside Down Pyramid Star Printing in C
#include <stdio.h>
int main()
{
int input;
do {
printf("ODD input please: ");
scanf("%d",&input);
}
while (input%2==0);
@SohanChy
SohanChy / Basic Star Printing.c
Last active August 29, 2015 14:23
Basic Star Printing
#include <stdio.h>
int main()
{
int input;
do {
printf("input please");
scanf("%d",&input);
}
while (input<=0);
@SohanChy
SohanChy / Simple basic C program to Convert Numbers to Binary.c
Last active August 29, 2015 14:23
Simple basic C program to Convert Numbers to Binary
#include<stdio.h>
int main(void) {
int input,binary=0,x;
//Take and see if input is a positive number
do {
printf("Please enter POSITIVE a number:");
scanf("%d",&input);}
while(input<0);
@SohanChy
SohanChy / BASIC Greedy Algorithm C.c
Last active August 29, 2015 14:23
BASIC Greedy Algorithm C
#include <stdio.h>
//1,2,5,10,20,50
int main()
{
int amount;
int fiftytk=0,twentytk=0,tentk=0,fivetk=0,twotk=0,onetk=0;
printf("Enter your Taka for CHANGE:\t");
scanf("%d",&amount);
int original_am=amount;
@SohanChy
SohanChy / Restaurant Menu EASY C.c
Last active August 29, 2015 14:23
Restaurant Menu EASY C
#include <stdio.h>
int main()
{
char choice;
printf("Please enter your choice a)Burger OR b)Sandwich OR c)Juice\n\t\t\t\t");
scanf("%c",&choice);
if(choice<97){choice=choice+32;}
@SohanChy
SohanChy / Count how many integers are in a number in C.c
Last active August 29, 2015 14:23
Count how many integers are in a number in C
#include <stdio.h>
int countnums(int x);
int main()
{
int input;
scanf("%d",&input);
printf("%d",countnums(input));
@SohanChy
SohanChy / NumberPyramid in C.c
Last active August 29, 2015 14:23
Number Pyramid in C
#include <stdio.h>
int doseries(int inp);
int main()
{
int input,i,j,n;
scanf("%d",&input);
n=doseries(input);
printf("\n");
@SohanChy
SohanChy / BubbleSort for array In C.c
Last active August 29, 2015 14:23
BubbleSort for array In C
#include <stdio.h>
void fprintArray(int arrayi[], int arrayLength);
int main()
{
//counters to use in all loops
int i,j;
@SohanChy
SohanChy / fprintArray.c
Last active August 29, 2015 14:24
Basic C function to print an INTEGER array
//Function printArray : PRINTS a Integer Array
void fprintArray(int arrayi[],int arrayLength)
{
int i;
for(i=0;i<arrayLength;i++)
{
printf(" %d",arrayi[i]);
}
@SohanChy
SohanChy / Caeser Cipher in C.c
Last active August 29, 2015 14:24
Encrypt & Decrypt input text to Caesar Cipher. (CS50). Input a numeric key and a text to encrypt it into ceaser ciphered code. Send it to anyone. Those who dont know the key cant read your message, those who have the key can decrypt and read it. :)
#include <stdio.h>
#include <string.h>
#include <ctype.h>
void caesarEncrypt(char plaintxt[], int key);
void caesarDecrypt(char plaintxt[], int key);
int main(void)
{
char plaintxt[500];