Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Ascending order

#include<stdio.h> #include<conio.h> void main() { int i,j,temp,a[7]; clrscr(); printf("Enter 7 integer numbers: \n"); for(i=0;i<7;i++) scanf("%d",&a[i]); for (i=0;i<7;i++) { for(j=i+1;j<7;j++) { if(a[i]<a[j]) { temp=a[j]; a[j]=a[i]; a[i]=temp; }}} printf("\n\nThe 7 numbers sorted in ascending order are: \n"); for(i=0;i<7;i++) printf("%d\t",a[i]); getch(); } /*

c program for area of a circle


#include <stdio.h> #define PI 3.141 int main(){ float r, a; printf("Radius: "); scanf("%f", &r); a = PI * r * r; printf("%f\n", a); return 0; }

C program for area of a triangle


include<stdio.h> #include<conio.h> #include<math.h> void main() { int a,b,c: float s,A,x=1/2; clrscr(); printf(" three sides of a triangle\n"); scanf("%d %d %d",&a,&b,&c); s=(a+b+c)/2; A=pow((s(s-a)(s-b))(s-c)),x); printf("AREA OF TRIANGLE:%d\n"'A); gech(); }

You might also like