<html lang="en"> <head> <title>VCET</title> <script> function image2(){ var a= document.getElementById("ds"); ds.src="2.jpg"; setTimeout(image3, 3000); } function image3(){ var a= document.getElementById("ds"); ds.src="3.jpg"; setTimeout(image4, 3000); } function image4(){ var a= document.getElementById("ds"); ds.src="4.jpg"; setTimeout(image5, 3000); } function image5(){ var a= document.getElementById("ds"); ds.src="5.jpg"; setTimeout(image1, 3000); } function image1(){ var a= document.getElementById("ds"); ds.src="1.jpg"; setTimeout(image2, 3000); } </script> </head> <body> <h2 align="center">Velammal college of Engineering and Technology</h2> <center><img src="1.jpg" id="ds" width="240" height="320" /><script>setTimeout(image2, 3000);</script></center> </body> </html>
/*Program to show sum of 10 elements of array & show the average.*/ #include<stdio.h> int main () { int a[ 10 ],i,sum = 0 ; float av; printf( "enter elements of an aaray: " ); for (i = 0 ;i < 10 ;i ++ ) scanf( "%d" , & a[i]); for (i = 0 ;i < 10 ;i ++ ) sum = sum + a[i]; printf( "sum=%d" ,sum); av = sum / 10 ; printf( "average=%.2f" ,av); return 0 ; } Output: enter elements of an array : 4 4 4 4 4 4 4 4 4 4 sum = 40 average = 4.00 /*Program to find the maximum no. in an array.*/ #include<stdio.h> void main () { int a[ 5 ],max,i; printf( "enter element for the array: " ); for (i = 0 ;i < 5 ;i ++ ) scanf( "%d" , & a[i]); max = a[ 0 ]; for (i = 1 ;i < 5 ;i ++ ) { if (max < a[i]) max = a[i]; } printf( "maximum no= %d" ,max); } Output: enter elements for array : 5 4 7 1 2 maximum no = 7 /*Swapp
Comments
Post a Comment