P12 - } 4)#include <stdio.h> int fn(void) void...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 1)#include <stdio.h> int SumElement(int,int*) void main(void) { int x[10] int i = 10 for( i ) { i-- *(x+i) = i }printf("%d",SumElement(x,10)) } int SumElement(int array[],int size) { int i = 0 float sum = 0 for( i<size i++) { sum+= array[i] return sum } 2)#include <stdio.h> void main(void) { int 1 = 100,j = 10,k = 20 int sum float ave char myformat[] = "ave = %f" sum = i + j + k ave = sum / 3.0 print(myformat,ave) } 3)#include <stdio.h> void main(void) void main(void) { struct s{ int x float y }s1={25,45.00} union u{ int x float y }u1 u1 = (unoin u)s1 printf("%d and %f",u1.x,u1.y)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } 4)#include <stdio.h> int fn(void) void print(int,int(*)()) int i = 10 Sheet1 Page 2 void main(void) { int i = 20 print(i,fn) } void print(int i,int (*fn1)()) { printf("%d\n",(*fn1()) } int fn(void) { return (i-=5) } 5)#include <stdio.h> void main(void) void main(void) { double dbl=20.4530,dblvar3 printf("%.2f\t%.2f\n%.2f\n",dbl,d,dblvar3) } 6)#include <stdio.h> void main(void) { int y,z int x=y=z=10 int f=x float ans=0.0 ans = x/3.0 + y/3 printf("%d %.2f",f,ans) }...
View Full Document

This note was uploaded on 06/27/2010 for the course MACS MCA taught by Professor Brs during the Spring '10 term at National Institute of Technology, Calicut.

Page1 / 2

P12 - } 4)#include <stdio.h> int fn(void) void...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online