Write a C program that convert an amount in dollar to an amount in FCFA.

Source Code

Brief explanation is provided after the source code.

#include <stdio.h>

int main(void)
    float fcfa, dollar;
    printf("Enter amount in Dollar: ");
    scanf("%f", &dollar);
    fcfa = dollar * 500;
    printf("Amount in FCFA: %.2f\n", fcfa);
    return 0;

When you compile and execute the above program it produces the following result on Linux:

Enter amount in Dollar: 2
Amount in FCFA: 1000.00

Brief Explanation

  • The program starts by requesting the user to enter an amount in dollar.
  • The equivalent amount in FCFA is computed by multiplying the dollar amount by 500 (dollar rate).
  • Using printf function, the converted amount is printed to the stdout screen.

Add comment

Security code