In this tutorial, we are going to write a C Program to use functions with no arguments and no return values in C Programming with practical program code and step-by-step full complete explanation.

C program to use functions with no arguments and no return values


C Program to use functions with no arguments and no return values.

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

void printline(void);
void value(void);

void main()
{
    printline();
    value();
    printline();
}

void printline(void)
{
    int i;

    for(i=1;i<=35;i++)
    {
        printf("%c",'-');
    }

    printf("\n");
}

void value(void)
{
    int year,period;
    float inrate,sum,principal;

    printf("Principal amount?");
    scanf("%f",&principal);
    printf("Interest rate?");
    scanf("%f",&inrate);
    printf("Period?");
    scanf("%d",&period);

    sum=principal;
    year=1;

    while(year<=period)
    {
        sum=sum*(1+inrate);
        year=year+1;
    }

    printf("\n%8.2f%5.2f%5d%12.2f\n",principal,inrate,period,sum);
}


Output

 
-------------------------
Principal amount? 5000
Interest rate? 0.12
Period 5

5000.00  0.12 5 8811.71
-------------------------