function - Issue with a begginers program in C -
im having issue output of program. not correctly receiving input. believe may have user defined function acts scanf
#include <stdio.h> #include <math.h> #define pi 3.14 int getnum(void) { homecoming scanf("%d"); } int calculatearear(int length, int width) { homecoming length*width; } double calculateareac(int radius) { homecoming pi*radius*radius; } int main(void) { int length; int width; int radius; int arear; double areac; printf( " please come in length of rectangle \n"); length = getnum(); printf(" please come in width of rectangle \n"); width = getnum(); printf(" please come in radius of circle \n"); radius = getnum(); arear = calculatearear(length, width); printf("\nthe area of rectangle %d\n", arear); printf("\nthe length %d, width is, %d , area of rectangle %d\n\n", length, width, arear); areac = calculateareac(radius); printf("\nthe area of circle %.3f\n", areac); printf("\n\n radius of circle %d , area of circle %.3f\n\n", radius, areac); homecoming 0; }
can help me? in advance!
you seek modifying programme this
int getnum(void) { int num; scanf("%d", &num); homecoming num;
}
c function
No comments:
Post a Comment