Skip to content

Instantly share code, notes, and snippets.

View manuj10's full-sized avatar
🚀
Building Mensari

Manuj Paliwal manuj10

🚀
Building Mensari
View GitHub Profile
@manuj10
manuj10 / vdu.c
Created August 22, 2012 08:20
This piece of code shows how we can access video memory and manipulate the corresponding memory addresses or we can say the color and characters at a memory location and can have fun with it.//compiled and run on turbo c/c++ version 3.0
#include<stdio.h>
#include<dos.h>
#include<conio.h>
#include<stdlib.h>
void main()
{char far *p;
char w[100];
int i,j,k;
int m=10;
p=(char far*) 0xb8000000L;//starting address of vdu memory
@manuj10
manuj10 / linked_list_and_operations.c
Created August 22, 2012 08:22
program to create a linked list and perform some operations such as :splitting linked list,concatenating linked list,displaying linked list.
#include<stdio.h>
#include<conio.h>
#include<alloc.h>
/*structure containing a data part and a link part*/
struct node
{int info;
struct node *link;
};
struct node* create_list(void);
void split_list_into_2(struct node **q);
@manuj10
manuj10 / factorialarge.c
Created August 24, 2012 11:21
computing factorial of a larger no
#include<stdio.h>
#include<stdlib.h>
int main()
{int pdt,rem=0,count,no;
long int x=0;
long int res[60000];
long register int i;
printf("enter the number whose factorial has to be calculated");
scanf("%d",&no);
for(i=0;i<60000;i++)
@manuj10
manuj10 / fibonacci
Last active December 13, 2015 18:19
computing fibonacci sum of even numbers upto 4,000000
#include <iostream>
int main()
{
using namespace std;
int num=0,num1=1,num0=0,sum=0;
while(num<=4000000)
{num=num1+num0;
num0=num1;
num1=num;
if(num%2==0)
@manuj10
manuj10 / Whazaa.c
Last active December 17, 2015 23:59
Gist containing solution to two problems: a)Write a function (in any language) which takes 'n' as an argument and prints all the numbers from 1 to 'n', except that: (a) if a number is divisible by 3, it should print 'Hip' instead of the number, (b) if divisible by 5 it should print 'Hop', and (c) if divisible by 3 & 5, it should print 'Whazaa' i…
//solution for part a
#include<stdio.h>
#include<conio.h>
int main()
{int input,i;
printf("Enter the number\n");
scanf("%d",&input);
for(i=1;i<=input;i++)
{if((i%3||i%5)==0)
printf("Whazaa\n");
@manuj10
manuj10 / file_input.c
Last active December 18, 2015 00:59
snippet for printing random numbers to a file
#include<stdio.h>
#include<stdlib.h>
int main()
{FILE * filepointer;
int v,i;
filepointer=fopen("input.txt","a+");
for (i=0;i<200;i++) /*getting numbers in range 0 to 50 randomly*/
{v=rand()%50;
fprintf(filepointer,"%d ",v);}