Program for find average of five numbers #include <stdio. h> #include <conio. h> int main() { int a, b, c, d, e; int sum=0; float avg; clrscr(); Printf ("enter the five number "); scanf ("%d%d%d%d%d",&a, &b, &c, &d, &e) ; sum=a+b+c+d+e; avg=sum/5; printf ("sum = %d\n",sum); printf ("average = %f",avg); return 0; getch(); }
program for sorting array using selection sort technique #include<stdio.h> #include<conio.h> #define size 10 /* you can define the size according to your choice */ void main() { int arr[size]; int i,j,temp; printf("enter array elements : "); for(i=0;i<size;i++) { scanf("%d",&arr[i]); } for(i=0;i<size-1;i++) { for(j=i+1;j<size;j++) { if(arr[i]>arr[j]) ...
Program to calculate the sum of given number using array #include<stdio.h> #include<conio.h> void main() { int arr[100]; int i,n,sum=0; clrscr(); /* clrscr() function is work only TURBO C/C++ compiler . It will not work in CODE BLOCKS compiler. */ printf("How many number you want to enter? "); scanf("%d",&n); printf("enter the array elements: "); for(i=0;i<n;i++) { scanf("%d",&arr[i]); } printf("your entered array is : ") for (i=0;i<n;i++) ...
Comments
Post a Comment