#include //#include int main() { /*char c; printf("Enter a character: "); c = getchar(); printf("The character is: %c\n", c); */ char str[100]; int i; printf( "Enter a string and value (separated by space):"); scanf("%s %d", str, &i); printf( "You entered: %s %d \n", str, i); /* char str1[100]; printf("Input a string"); gets(str1); printf("The string is: "); puts(str1); char str[100]; printf( "Enter a string: "); gets(str); printf( "You entered: %s \n", str); printf("puts Output is: "); puts(str); int a, b; printf("Enter 2 numbers (separated by space): "); scanf("%d %d",&a, &b); //printf("%d * %d = %d\n", a, b, a*b); printf("%d\n * %d\n= %d\n", a, b, a * b); printf("%7d\n* %5d\n= %5d\n", a, b, a * b); float a, b; printf("Enter 2 float numbers (separated by space): "); scanf("%f %f",&a, &b); printf("%f * %f = %f\n", a, b, a*b); printf("%.2f * %.2f = %0.4f\n", a, b, a*b); //To compile, you have to use -std=c99 and -lm switches printf(" x sqrt(x)\n"); printf("-------------\n"); for (int i = 2; i < 20; i++) { printf("%3d%10.4f\n", i, sqrt(i)); } printf("'%5d'\n", 10); printf("'%-5d'\n", 10); printf("'%05d'\n", 10); printf("'%+5d'\n", -10); printf("'%+-5d'\n", 10); printf("'%.1f'\n", 10.3456); printf("'%.2f'\n", 10.3456); printf("'%8.2f'\n", 10.3456); printf("'%8.4f'\n", 10.3456); printf("'%08.2f'\n", 10.3456); printf("'%-8.2f'\n", 10.3456); printf("'%-8.2f'\n", 101234567.3456); float pi; printf("Enter the value of pi: "); scanf("%f", &pi); printf("The value of pi is %f \n", pi); int pi_ipart, pi_dpart; printf("Enter the value of pi: "); scanf("%d.%3d", &pi_ipart, &pi_dpart); printf("The value of pi is %d.%d \n", pi_ipart, pi_dpart); */ return 0; }