Skip to content

Instantly share code, notes, and snippets.

@only-entertainment
Forked from anonymous/stuff
Created September 4, 2012 19:11
Show Gist options
  • Save only-entertainment/3625188 to your computer and use it in GitHub Desktop.
Save only-entertainment/3625188 to your computer and use it in GitHub Desktop.
MC
#include <stdio.h>
#include <stdlib.h>
int main(int agrv, char * argc[])
{
float N = 0;
printf("Enter a number?");
scanf("%f", &N);
{
double num = N;
int intpart = (int)num;
double decpart = num - intpart;
printf("Number = %f, Integer = %d, Decimal = %f\n", num, intpart, decpart);
}
}
@only-entertainment
Copy link
Author

include <stdio.h>

include <stdlib.h>

int main(int agrv, char * argc[])
{
float N = 0;
printf("Enter a number?");
scanf("%f", &N);

    int foo = 1;
    printf("FOO #1: %d\n", foo);


    {
            int foo = 2;
            printf("FOO #2: %d\n", foo);

            double num = N;
            int intpart = (int)num;
            double decpart = num - intpart;
            printf("Number = %f, Integer = %d, Decimal = %f\n", num, intpart, decpart);
    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment