ulvis.paste.net

Paste Search Dynamic
Recent pastes
Enter a positive Integer
  1. // C code
  2. // This program will calculate 3.14 times the square of input unit
  3. // Developer: Faculty CMIS102
  4. // Date: April 28, 2018
  5. #include <stdio.h>
  6.  
  7. // Function prototypes
  8. double Myfunction (int value);
  9.  
  10.  
  11. int main (void)
  12. {
  13.    /*variable definition: */
  14.    int intValue;
  15.    double Results;
  16.    intValue = 1;
  17.  
  18.     while (intValue > 0)
  19.       {
  20.    printf("Enter a positive Integer\n: ");
  21.    scanf("%d", &intValue);
  22.  
  23.  
  24.      if (intValue > 0)
  25.         {
  26.           Results = Myfunction(intValue);
  27.           printf("With the given value %d,  3.14*%d*%d = %f\n: ",intValue,intValue,intValue,Results);
  28.         }
  29.        else
  30.        printf("Enter a positive Integer\n: ");
  31.       }  
  32.     return 0;
  33. }
  34. /* funtion returning 3.14 times Square of the input number */
  35. double Myfunction (int value)
  36. {
  37.         return (double) 3.14*value*value;
  38.  
  39. }
Parsed in 0.004 seconds