/*A decimal integer is input,added to CONSTANT and the sum is displayed .If the sum is less than 20, a message is issued*/
Solution code:-
========
#include <stdio.h>
#define CONSTANT 7
int sum(int num,int constant);
int main(void)
{
int i,add;
printf("Enter a decimal integer : ");
scanf("%d",&i);
add = sum(i,CONSTANT);
if ( add < 20 )
printf("\nAmount %d is less than 20",add);
return 0;
}
int sum(int num,int constant)
{
return (num + constant);
}
No comments:
Post a Comment