Functions - void calc() { sum=x+y+z; avg=sum/(float)3; }...

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(&quot;The sum is %d\n&quot;,sum); printf(&quot;The avg is %f\n&quot;,avg); } void main() { load(); calc(); print(); }...
View Full Document

Ask a homework question - tutors are online