ਯੂਜ਼ਰ ਡਿਫਾਇੰਡ ਫੰਕਸ਼ਨ ਜੋ ਕਿ ਵਿਆਜ ਦਰ ਅਨੁਸਾਰ ਮੂਲ ਰਕਮ ਤੇ ਵਿਆਜ ਪਤਾ ਕਰੇ, ਲਈ ਪ੍ਰੋਗਰਾਮ ਲਿਖੋ।

#include <stdio.h>
#include <conio.h>

float interest(int p, int t, float r);
void main()
{
    int p, t;
    float r, in;
    printf("Enter Principal Amount : ");
    scanf("%d",&p);
    printf("Enter time period (years): ");
    scanf("%d",&t);
    printf("Enter rate of interest: ");
    scanf("%f",&r);
    in=interest(p,t,r);
    printf("Total interest: %f",in);
    getch();
}

float interest(int p, int t, float r)
{
    float i;
    i=p*r*t/100;
    return i;
}

Output


Comments