Skip to content

Instantly share code, notes, and snippets.

@mjcarnaje
Last active November 9, 2021 04:57
Show Gist options
  • Save mjcarnaje/18f24683bba086369b52fcfb5e3f5dfb to your computer and use it in GitHub Desktop.
Save mjcarnaje/18f24683bba086369b52fcfb5e3f5dfb to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main()
{
int index = 0;
for (int i = 1; i <= 16; i = i * 2)
{
printf("%2d %2d\n", index, i);
++index;
}
}
#include <stdio.h>
#define INCHES_IN_CM 0.3937
int main()
{
int small, large;
printf("\nEnter smaller number: ");
scanf("%d", &small);
do
{
printf("\nEnter larger number: ");
scanf("%d", &large);
if (large < small)
{
printf("\nError: Enter number greater than smaller number\n");
}
if ((large - small) > 10)
{
printf("\nError: Numbers should have only 10 interval\n");
};
} while (large < small || ((large - small) > 10));
for (int i = small; i <= large; i++)
{
printf("%d %f\n", i, i * INCHES_IN_CM);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment