// proj1.c // CSE 130 Fall 2009. Project 1, Oct 03, 2009. // Reza Basseda, Id-No: #include int main (void) { //Declares and initializes all needed variables int m, n, m_cube, n_cube; int iq, r_cube; double ftq; //Variables required for the loop needed in the 2nd part int count = 0; int product = 1; //Part 1 // Print a message and notify the user and get // values for m and n from standard input printf("Enter two numbers m and n respectively:\n"); scanf("%d%d", &m, &n); //Calculates values as defined in the questions m_cube = m*m*m; n_cube = n*n*n; iq = n_cube/m_cube; r_cube = n_cube%m_cube; ftq = (float)n_cube/m_cube; //Prints results of calculations printf ("m_cubed = %d, n_cubed = %d, iq = %d, r_cube = %d \n \n",m_cube, n_cube, iq, r_cube); printf ("floating point division ftq = %g\n\n",ftq); //Part 2 //A while loop to get n raised to the m power while (count < m) { product = product * n; count = count+1; } //result of the loop is printed printf ("%d raised to %d = %d\n\n", n, m, product); //that's all folks. return 0; }