C Program to arrange numbers in ascending order

  #include <stdio.h> void sort_numbers_ascending(int number[], int count) { int temp, i, j, k; for (j = 0; j < count; ++j) { for (k = j + 1; k < count; ++k) { if (number[j] > number[k]) { temp = number[j]; number[j] = number[k]; number[k] = temp; } } } printf(“Numbers in ascending order:\n”); … Read more

C Program to calculate Area of Equilatral triangle

#include<stdio.h> #include<math.h> int main() { int triangle_side; float triangle_area, temp_variable; printf(“\nEnter the Side of the triangle:”); scanf(“%d”,&triangle_side); temp_variable = sqrt(3) / 4 ; triangle_area = temp_variable * triangle_side * triangle_side ; printf(“\nArea of Equilateral Triangle is: %f”,triangle_area); return(0); }  

C Program for bubble sorting

#include<stdio.h> int main(){ int count, temp, i, j, number[30]; printf(“How many numbers are u going to enter?: “); scanf(“%d”,&count); printf(“Enter %d numbers: “,count); for(i=0;i<count;i++) scanf(“%d”,&number[i]); for(i=count-2;i>=0;i–){ for(j=0;j<=i;j++){ if(number[j]>number[j+1]){ temp=number[j]; number[j]=number[j+1]; number[j+1]=temp; } } } printf(“Sorted elements: “); for(i=0;i<count;i++) printf(” %d”,number[i]); return 0; }