1.
#include <stdio.h>
int main(void)
{
int a = 0xFFFFFFFF + 1;
float b = 3.4e38 * 100.0f;
float c = 0.34e-38 / 3.4e38f;
printf("%d\n",a);
printf("%e\n",b);
printf("%e\n",c);
return 0;
}
2.
#include <stdio.h>
int main(void)
{
char ascall;
printf("Enter an ascall code: ");
scanf("%d",&ascall);
printf("%d is the ascall code for %c.\n",ascall,ascall);
return 0;
}
3.
#include <stdio.h>
int main(void)
{
printf("\a");
printf("Started by the sudden sound, Sally shouted,\n");
printf("\"By the Great Pumpkin, what was that!\"");
return 0;
}
4.
#include <stdio.h>
int main(void)
{
float l_num;
printf("enter a floating-point value: ");
scanf("%f",&l_num);
printf("fixed-point notation: %f\n",l_num);
printf("exponential notation: %e\n",l_num);
printf("p notation: %a",l_num);
return 0;
}
5.
#include <stdio.h>
int main(void)
{
float age;
float secs;
printf("enter your age:");
scanf("%f",&age);
secs = age * 3.156e7;
printf("The secs is: %.0f",secs);
return 0;
}
6.
#include <stdio.h>
int main(void)
{
float mass_mol = 3.0e-23;
float mass_qt = 950;
float quarts;
float molecules;
printf("enter the number of quarts of water: ");
scanf("%f",&quarts);
molecules = quarts * mass_qt / mass_mol;
printf("%f quarts of water contain %e molecules.\n",quarts,molecules);
return 0;
}
7.
#include <stdio.h>
int main(void)
{
float inch_cm = 2.54;
float high;
float centimeters;
printf("Please enter the inches of your height: ");
scanf("%f",&high);
centimeters = high * inch_cm;
printf("Your height in centimeters is: %.2f 2cm",centimeters);
return 0;
}
8.
#include <stdio.h>
int main(void)
{
float pints;
float cups;
float ounces;
float ladles;
float tea_spoons;
printf("please enter the number of cups: ");
scanf("%f",&cups);
pints = cups / 2.0f;
ounces = cups * 8.0f;
ladles = ounces * 2.0f;
tea_spoons = ladles * 3.0f;
printf("%.1f cups = %.1f pints = %.1f ounces = %.1f ladles = %.1f tea_spoons",cups,pints,ounces,ladles,tea_spoons);
return 0;
}