Last active
November 9, 2021 04:57
-
-
Save mjcarnaje/18f24683bba086369b52fcfb5e3f5dfb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int index = 0; | |
for (int i = 1; i <= 16; i = i * 2) | |
{ | |
printf("%2d %2d\n", index, i); | |
++index; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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