跳轉到內容

讓我們 GCC/Code 1.2

來自華夏公益教科書,為開放世界提供開放書籍

舊程式碼

[編輯 | 編輯原始碼]
/* Calculation of simple interest */
/* Author gekay Date 25/05/2004 */
main( )
{
    int p, n ;
    float r, si ;
    printf ( "Enter values of p, n, r" ) ;
    scanf ( "%d %d %f", &p, &n, &r ) ;
    
    si = p * n * r / 100 ;
    printf ( "%f" , si ) ;
}

新程式碼

[編輯 | 編輯原始碼]
/* Calculation of simple interest */
/* Author gekay Date 25/05/2004 */
/* Editor GReaperEx Date 19/7/2015 */

#include <stdio.h>

int main(void)
{
    int p, n ;
    float r, si ;

    printf("Enter values of p, n, r");
    scanf("%d%d%f", &p, &n, &r);

    si = p*n*r/100 ;
    printf("%f", si);
}
華夏公益教科書