Functions - void calc sum=x y z avg=sum(float)3 void print...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// This program demonstrates the use of functions with the main last #include <stdio.h> int x,y,z,sum; float avg; void load() { printf("Enter 3 numbers"); scanf("%d%d%d",&x,&y,&z); }
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: void calc() { sum=x+y+z; avg=sum/(float)3; } void print() { printf("The sum is %d\n",sum); printf("The avg is %f\n",avg); } void main() { load(); calc(); print(); }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online