stack - tape calculator

Submitted scripts and programs
Forum rules
Your own work only.
machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

stack - tape calculator

Unread post by machinebacon » Thu Jan 28, 2016 6:37 pm

there is something called "tapecalc" in the repos, but I wanted something that does nothing else than adding input to a stack until terminated with C-c.

Code: Select all

#include<stdio.h>

float n,stack;

int main()
{
	for( ; ; ) {
	    printf("+ ");
	    scanf("%f",&n);
	    stack = n+stack;
	    printf("= %.1f\n", stack);
	}
	return 0;
}
..gnutella..

Post Reply