multiply.c

来自「c21Examples.rar」· C语言 代码 · 共 31 行

C
31
字号
/* Program to calculate the product of two numbers. */
#include <stdio.h>

int val1, val2, val3;

int product(int x, int y);

int main( void )
{
   /* Get the first number */
   printf("Enter a number between 1 and 100: ");
   scanf("%d", &val1);

   /* Get the second number */
   printf("Enter another number between 1 and 100: ");
   scanf("%d", &val2);

   /* Calculate and display the product */
   val3 = product(val1, val2);
   printf ("%d times %d = %d\n", val1, val2, val3);

   return 0;
}

/* Function returns the product of the two values provided */
int product(int x, int y)
{
    return (x * y);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?