Skip to content

Instantly share code, notes, and snippets.

@rbe
Created August 2, 2012 08:59
Show Gist options
  • Select an option

  • Save rbe/3235603 to your computer and use it in GitHub Desktop.

Select an option

Save rbe/3235603 to your computer and use it in GitHub Desktop.
2^x
#include <stdio.h>
#include <math.h>
#include <assert.h>
void main()
{
int i, x;
printf ( "\n2^x für OS/2." );
printf ( "\nCopyright (C) 1995 von Ralf Bensmann" );
printf ( "\nErstellt in GNU C/C++ für OS/2.");
printf ( "\n\nGeben Sie x ein: " );
assert ( scanf ( "%d", &x ) );
printf ( "\n2 hoch x. x e [0; %d]\n\n", x );
for ( i = 0; i < x+1; i++ )
printf ( "2^%d = %.0f\n", i, pow ( 2, i ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment