Coding Horror

June 3, 2012 at 2:17 pm | Posted in art, Programming | Leave a comment
Tags: , , ,

Recently I was reading an article on coding horror which mentioned that most of the software developers who come for interview can’t even program and later I came across another article regarding phone screening interview and he mentioned Steve Yegge’s 5 essential phone screen questions. I looked at them and I thought .. whoaaa.. so easy. I was with my friend on his Windows machine and did not have access to some Linux machine. So I downloaded Bloodshed’s Dev-C++ compiler and typed this code and ran several tests, all in 20 minutes. (Bloodshed Dev-C++ version 5.2.0.2). I solved only several questions, will solve others when I get time to sit on machine next time. For now, just enjoy my C code :)

/* (1) Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the 
number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz".

 (2) Write function to compute Nth fibonacci number

 (3) print all odd numbers between 1 and 99
 */

#include <stdio.h>

enum { LIMIT = 100 };

void fib(const int n);
void print_odds(const int limit);
void print_fizzbuzz(const int limit);

int main(void)
{
	print_fizzbuzz(LIMIT); 
	printf("\n\n");
	print_odds(LIMIT-1); 
	printf("\n\n");
	fib(20);
	return 0;
}

/* No int/unsigned-long overflow check */
void fib(const int n)
{
	unsigned long f0 = 0;
	unsigned long f1 = 1;
	unsigned long fnum = f1;
	int i;
	if((0 == n) || (1 == n))
	{
		printf("fib(%d) = %d\n", n, n);
		return;
	}
	for(i = 2; i <= n; ++i)
	{
		fnum = f1 + f0;
		f0 = f1;
		f1 = fnum;
	}
	
	printf("fib(%d) = %lu", n, fnum);
}

void print_odds(const int limit)
{
	int i;
	for(i = 1; i <= limit; i = i + 2)
	{
		printf("%d\t", i);
	}
	printf("\n");
}

void print_fizzbuzz(const int limit)
{
	int i;
	for(i = 0; i <= limit; ++i)
	{
		if((0 == i%3) && (0 == i%5))
		{
			printf("fizzbuzz\t");
		}
		else if(0 == i%3)
		{
			printf("fizz\t");
		}
		else if(0 == i%5)
		{
			printf("buzz\t");
		}
		else
		{
			printf("%d\t", i);
		}
	}
	printf("\n");
}

 


Copyright © 2012 Arnuld Uttre, Village – Patti, P.O – Manakpur, Tehsil – Nangal, Distt. – Ropar, Punjab (INDIA)

Verbatim copying and distribution of this entire article are permitted worldwide, without royalty, in any medium, provided this notice, and the copyright notice, are preserved.

My Open-Sharing Logo

November 10, 2007 at 3:45 pm | Posted in art | Leave a comment

This was the 1st logo I created to support open sharing but did not publish it on my blog, I just distributed it through other mediums. If you like it, please help me find a job as an OpenSource Developer/Programmer. I will really appreciate your act :)

Open Sharing Logo


Copyright © 2007, Arnuld
Uttre, #331/type-2/sector-1, Naya Nangal, Distt. – Ropar, Punjab (INDIA)

any work on this page falls under one of these 2 categories: either “text” or “art”. For “text work”, Verbatim copying and distribution are permitted worldwide, without royalty, in any medium, provided this notice, and the copyright notice, are preserved. “art work”, falls under Free Art License. read this:

Copyleft: this work of art is free, you can redistribute it and/or modify it according to terms of the Free Art license. You will find a specimen of this license on the site Copyleft Attitude http://artlibre.org as well as on other sites.

Welcome to My New Blog

October 20, 2007 at 2:49 pm | Posted in art, History | Leave a comment

 

Hi All, I just changed the look of my blog. I have created some images and I they can be used as header images in WordPress blogs :-). I created those images myself using GIMP :-) with the help of some pictures available at Wikipedia under Creative Commons Attribution Share Alike License. The 1st 2 patterns represent the Design-Patterns we use to solve problems. I am not talking only about OOD here, there are 4 patterns in total, 2 look same and other 2 are different. Together all they represent the general-patters individuals identify in their lives and then use their intellect to solve their problems, whether personal, professional or in war or in building a “start-up software company”.

The Lambda here represents my favourite language Common Lisp. Lambda is represented with 4 dots, which actually is the Haskell Logo (in Public Domain) from here: http://haskell.org/haskellwiki/Image:Simple-haskell-logo.png

I have also have some other versions of header, see:

BLOG Header

Aqua Header

1st header

BLOG header fresh

Header hard-coded

Copyright © 2007, Arnuld Uttre, #331/type-2/sector-1, Naya Nangal, Distt. – Ropar, Punjab (INDIA)

any work on this page falls under one of these 2 categories: either “text” or “art”.

for “text work”, Verbatim copying and distribution are permitted worldwide, without royalty, in any medium, provided this notice, and the copyright notice, are preserved.

“art work”, falls under Free Art License. read this: Copyleft: this work of art is free, you can redistribute it and/or modify it according to terms of the Free Art license. You will find a specimen of this license on the site Copyleft Attitude http://artlibre.org as well as on other sites.

Copyleft Logo (Hebrew)

September 1, 2007 at 7:57 am | Posted in art | Leave a comment

I have created a new Copyleft Logo by using the Hebrew Language. In Hebrew Language, the English alphabets C and G are represented by one letter named Gimel . you can find a lot about these language and many others and their alphabets at World’s biggest Encyclopedia: http://en.wikipedia.org/wiki/Main_Page

 

So I reversed the Gimel, just like reversed C in Copyleft logo :) and here is what I designed then:

Copyleft_Hebrew - white Copyleft_Hebrew - transparent Copyleft_Hebrew - patters-plywood-LIGHT Copyleft_Hebrew - patters-plywood-BLUE

Copyleft_Hebrew -  3 colors Copyleft_Hebrew - green-on-blue-pattern Copyleft_Hebrew - green-on-blue-pattern-STONES

I will publish more logos created in several different languages :-)



Copyright © 2007, Arnuld
Uttre, #331/type-2/sector-1,
Naya Nangal, Distt. – Ropar, Punjab (INDIA)

any work on this page falls under one of these 2 categories: either “text” or “art”.

for “text work”, Verbatim copying and distribution are permitted worldwide, without royalty, in any medium, provided this notice, and the copyright notice, are preserved.

“art work”, falls under Free Art License. read this:

Copyleft: this work of art is free, you can redistribute it and/or modify it according to terms of the Free Art license. You will find a specimen of this license on the site Copyleft Attitude http://artlibre.org as well as on other sites.

Copyleft Logo

September 1, 2007 at 7:31 am | Posted in art | 2 Comments

This is the modified Copyleft Logo. I got the original one from Wikipedia . There are 2 versions, black & green and both are in public domain. So I took the liberty to apply some designs and patterns I like :-) and here is the output:

Copyleft tiger-white-blue Copyleft trio Copyleft trio-TEXT Copyleft trio-TEXT-rotated

 


 


Copyright © 2007, Arnuld
Uttre, #331/type-2/sector-1,
Naya Nangal, Distt. – Ropar, Punjab (INDIA)

any work on this page falls under one of these 2 categories: either “text” or “art”.

for “text work”, Verbatim copying and distribution are permitted worldwide, without royalty, in any medium, provided this notice, and the copyright notice, are preserved.

“art work”, falls under Free Art License. read this:

Copyleft: this work of art is free, you can redistribute it and/or modify it according to terms of the Free Art license. You will find a specimen of this license on the site Copyleft Attitude http://artlibre.org as well as on other sites.

Next Page »

Create a free website or blog at WordPress.com. | The Pool Theme.
Entries and comments feeds.

Follow

Get every new post delivered to your Inbox.