A C program that contain conditional statement, loop statement, and functions.
Make it simple plz
1
Expert's answer
2011-05-23T09:58:20-0400
#include <stdio.h> #include <conio.h>
// Function that prints "Hello World" on console void print_hello();
// Function that computes the cube of the integer long cube(int pNumber);
// Function that defines is the integer positive // (uses the condition statement) int is_positive(int pNumber);
int main() { int i;
print_hello();
// Using the condition define is zero positive number if (is_positive(0) == 1) & printf("Zero is positive\n"); else & printf("Zero isn't positive\n");
// Using the cycle print the cubes of integers from 0 to 9 for (i = 0; i < 10; i++) & printf("The cube of %d is %d\n", i, cube(i));
getch(); // Waiting for user's action return 0; }
// Function that prints "Hello World" on console void print_hello() { printf("Hello world!\n"); }
// Function that computes the cube of the integer long cube(const int pNumber) { return pNumber * pNumber * pNumber; }
// Function that defines is the integer positive // (uses the condition statement) int is_positive(int pNumber) { if (pNumber > 0) & return 1; else & return -1; }
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment