int a = 3, b = 17 ;
a = b % a ;
b = ++a + 5 ;
printf("a = %d, b = %d\n", a, b) ;
int a = 5, b = 4, c = 1 ;
if ( a < b + 1 ) {
printf("Tea, Earl Grey, Hot!\n") ;
} else if ( a > b + c ) {
printf("Ahead warp factor 9. Engage!\n") ;
} else if ( a % b >= c ) {
printf("Warp core breach in 20 seconds!\n") ;
} else {
printf("I sense a lot of anxiety in this room.\n") ;
}
int i, total ;
for (i = 1 ; i <= 15 ; i++)
{
if ( i % 3 == 0)
{
printf("%d ", i) ;
}
}
printf("\n\n");
test = FALSE ;
if (test = TRUE) {
printf("Beam down the landing party.\n") ;
} else if (test == FALSE) {
printf("Jim, he's dead.\n") ;
} else if (test == TRUE) {
printf("Scotty, four to beam up.\n") ;
}
for (i = LOWER; i <= UPPER; i++)
{
if (i % 5 == 0)
{
printf("%d is a multiple of 5\n", i);
}
else
{
printf("%d is not\n", i);
}
}
#include <stdio.h>
int Deep(int, int) ;
int Space(int) ;
main()
{
int a = 2, b = 3, c = 3 ;
a = Deep (b + 5, c) ;
b = Space (c) ;
printf ("main: a = %d, b = %d, c= %d\n", a, b , c) ;
}
int Deep (int x, int y)
{
int z ;
z = x - y ;
printf ("Deep: x = %d, y = %d, z = %d\n", x, y, z) ;
return (z) ;
}
int Space (int c)
{
int a, b ;
a = 1 ;
b = c * 2 + a ;
a = b + 5 ;
c = Deep (a, b) ;
printf ("space: a = %d, b = %d, c = %d\n", a, b, c) ;
return (b) ;
}
int m = 5, n = 8; float x = 9.0; What is the value and type of the expression m + n * x ?
int i, j;
for (i = 0; i <= 3; i++)
{
for (j = 0; j <= 4; j++)
{
if ( (i + 1 == j) || (j + i == 4) )
{
printf ("+");
}
else
{
printf ("o");
}
}
printf ("\n");
}
void PrintBox (int rows, int columns, char ch); This call to PrintBox, PrintBox(3, 10, '$'); should print:
$$$$$$$$$$ $$$$$$$$$$ $$$$$$$$$$
1/1 + 1/2 + 1/3 + . . . + 1/nThis is called a ``partial Harmonic series''. The various fractions, and the returned value should be of type double.
________ FindNet ( int hours, ________ ______ , int _______ )
{
double ________ , __________ ;
int ___________ ;
if ( _______ > 40 _____ (!exempt ) )
{
extraHours = hours - 40;
grossPay = (40 * _______ ) + extraHours * (rate * _____);
}
else
{
grossPay = hours * _______ ;
}
if (grossPay > ________ )
{
netPay = grossPay - grossPay * _______ ;
}
______
{
netPay = grossPay - grossPay * _______ ;
}
________ ("Hours = %d and Net Pay = _______ \n", hours, netPay);
________ ( __________ );
}
________ PrintRandomPhoneNumber ( ________ seed )
{
int digit1 , ________, digit3, firstThree, lastFour;
/* Seed the random number generator */
_____________(seed);
/* Generate the first two digits individually */
digit1 = rand( ) ______ 8 + 2;
________ = rand ( ) % ________ + ________ ;
/* Generate the third digit */
________ = rand ( ) % ________ ;
/* Calculate the 3-digit integer called firstThree */
firstThree = digit1 * ________ + ________ * _______ + digit3;
/* Generate a four-digit integer */
lastFour = ________( ) % ________ ;
/* Print the random phone number */
_______ ("_______-_______\n", _______, ______ );
}
| gpa range | student rating |
|---|---|
| 3.50 - 4.0 | Dean's list |
| 2.0 - 3.49 | Satisfactory |
| 1.0 - 1.99 | Probation |
| 0.0 - 0.99 | Suspended |
3d XyYzZx ABC123 __yes star*it m me_to-2 main money$
int a = 17, b;
b = a;
printf ("b = %d\n", b);
b = b + 1;
printf ("b = %d\n", b);
b = a / b;
printf ("b = %d\n\n\n", b);
include (stdio.h)
main{} / Program execution begins here /
(
people, legs integer;
print ("How many people are there?/n);
scanf ("%d", people);
legs = people * 2
print ("There are %f legs.");
[end main]
Evaluate each expression below as TRUE or FALSE.
_______ (1) c / b == 2 _______ (2) c % b <= a % b _______ (3) b + c / a != c - a _______ (4) (b < c) && (c == 7) _______ (5) (c + 1 - b == 0) || (a = 5)
printf ("We sell ");
printf ("C shells\n");
printf ("by the\nsea shore\n");
printf ("%.2f", 3.859143);
printf ("%.2f", 1.3e2);
int a = 2, b = 3;
b *= a;
a += b++;
printf ("%d %d\n", a, b);
int m = 5, n = 8;
printf ("%d %d\n", m % n, n % m);
int x = 12, y = 28;
printf ("%d %d\n", x / y, y / x);
void F (int x);
void G (int x);
main ()
{
G (3);
F (2);
G (5);
}
void F (int x)
{
printf ("%d ", x);
}
void G (int x)
{
F (x + 1);
printf ("%d ", x);
}
int X (int m);
int Y (int n);
main ()
{
int r, s;
r = X (5);
s = Y (10);
printf ("main: %d %d\n"), r, s);
}
int X (int m)
{
printf ("X: %d\n", m);
return (m + 2);
}
int Y (int n)
{
printf ("Y: %d %d\n", n, X (n));
return (n * 3);
}
int a = 5, b = 4;
b += a;
a -= ++b;
printf ("%d %d\n", a, b);
a = 13;
b = 4;
printf ("%d %d\n", a / b, b / a);
printf ("%d %d\n", a % b, b % a);
int x = 1;
if (x > 3)
{
if (x > 4)
{
printf ("A");
}
else
{
printf ("B");
}
}
else if (x < 2)
{
if (x != 0)
{
printf ("C");
}
}
printf ("D");
int n = 1234;
while (n > 0)
{
n /= 10;
printf ("%d\n", n);
}
int j, k;
for (j = 1; j <= 4; j++)
{
for (k = 1; k <= j; k++)
{
printf ("*");
}
printf ("\n");
}
int g, h;
for (g = 1; g <= 3; g++)
{
for (h = 0; h < 3; h++)
{
if (g == h)
{
printf ("O");
}
else
{
printf ("X");
}
}
printf ("\n");
}
int m;
for (m = 1; m <= 5; m++)
{
switch (m)
{
case 1:
printf ("one");
break;
case 2:
printf ("two");
break;
case 3:
printf ("three");
break;
default:
printf ("Default case");
}
printf ("\n");
}
int F1 (int a, int b);
int F2 (int b, int c);
main()
{
int a = 1, b = 2, c = 3;
c = F1 (a, b);
printf ("main: %d %d %d\n", a, b, c);
b = F2 (a, c);
printf ("main: %d %d %d\n", a, b, c);
}
int F1 (int a, int b)
{
printf ("F1: %d %d\n", a, b);
return a;
}
int F2 (int b, int c)
{
printf ("F2: %d %d\n", b, c);
return c;
}
int F1 (int a, int b);
int F2 (int a, int b);
main()
{
int a = 1, b = 2, c = 3;
c = F1 (a, b);
printf ("%d %d %d\n", a, b, c);
b = F2 (a, c);
printf ("%d %d %d\n", a, b, c);
a = F2 ( F1 (a, c), b);
printf ("%d %d %d\n", a, b, c);
b = F2 (a, c) / F1 (b, c);
printf ("%d %d %d\n", a, b, F1 (a, b) );
}
int F1 (int a, int b)
{
return (a + b + 3);
}
int F2 (int a, int b)
{
return ( (a + b) % 3 );
}