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); }  

Selection Sort Program in C

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

C Program to Find Quotient and Remainder

  #include <stdio.h> int main(){ int num1, num2, quot, rem; printf(“Enter dividend: “); scanf(“%d”, &num1); printf(“Enter divisor: “); scanf(“%d”, &num2); quot = num1 / num2; rem = num1 % num2; printf(“Quotient is: %d\n”, quot); printf(“Remainder is: %d”, rem); return 0; }  

C Program to convert uppercase string to lowercase string

#include<stdio.h> #include<string.h> int main(){ /* This array can hold a string of upto 26 * chars, if you are going to enter larger string * then increase the array size accordingly */ char str[26]; int i; printf(“Enter the string: “); scanf(“%s”,str); for(i=0;i<=strlen(str);i++){ if(str[i]>=65&&str[i]<=90) str[i]=str[i]+32; } printf(“\nLower Case String is: %s”,str); return 0; }

Write a C program to calculate the area & perimeter of the rectangle, and the area & circumference of the circle

C Programming Tutorial

Problem Statement: The length & breadth of a rectangle and radius of a circle are input through the keyboard. Write a program to calculate the area & perimeter of the rectangle, and the area & circumference of the circle. Answer: /* Calculation of perimeter and area of rectangle and circle */ #include<stdio.h> #include<conio.h> main() { … Read more