Write a program to calculate daily expenditure if monthly expenditure is given using loop.
SOLUTION:
/*
* Calculate daily expenditure if monthly expenditure is given using loop.
* Written by Shaeed Khan.
* Date: 04 Aug 2014
* Version- 1.0
* Language: C
*/
#include < stdio.h >
#include < stdlib.h >
void main()
{
int x,n;
printf("Enter monthely expenditure :");
scanf("%d",&n);
x=daily_exp(n);
printf("%d ",x);
}
int daily_exp(int n)
{
int c=0;
while(n>0)
{
c++;
n=n-30;
}
return c;
}
No comments:
Post a Comment