Skip to content

Instantly share code, notes, and snippets.

alert('test');
@SemanticallyNull
SemanticallyNull / average.c
Created November 7, 2011 11:22
More C... when will it end?
#include <stdio.h>
int main() {
int age;
int sum = 0;
float avrg;
int x;
printf("I'm going to ask 10 people for their age and then find the average\n");
printf("of their ages at the end, just for fun!\n\n");
@SemanticallyNull
SemanticallyNull / if.c
Created November 6, 2011 13:38
Finally began messing around with C... much is coming back to me now, and realising how little I know.
#include <stdio.h>
int main(void) { // Thanks to @barrettcolin for showing me the way.
int age;
printf("What is your age? ");
scanf("%d", &age); // Accept a numeric input and push it to age (by getting the lvalue of age)
if(age < 5) {
printf("Wow, you're very young!\n");
} else if(age < 12) {