Browsing Category

# Computer Science

## [C/C++] Convert Given Number of Days into Years, Weeks and Days

Program to convert given number of days into years, weeks and days Get number of days from user Divide number of days with 365 to get number of years For week take mod with 365 days and divide it with 7 you'll get weeks And for…

## [C/C++] Swap 2 Variable Without Using Third Variable

Program to swap 2 variable values without using third variable Add both variables in 2nd variable subtract 1st from 2nd and store it in 1st subtract 1st from 2nd and store it in 2nd C Code #include <stdio.h> #include…

## [C/C++] Program to Swap 2 Variable Using Third Variable

Program to swap 2 variable values using third variable Store value of 1st variable in third variable that is temporary Store value of 2nd variable in 1st variable Now store value of temp or third variable in 2nd C Code #include…

## [C/C++] Program to Find The Area of Circle

Program to find area of circle using radius or diameter 2 functions one will calculate and return area of circle by multiplying radius Other function will get diameter as parameter and will divide it to half which is equals to radius…

## [C/C++] Program to Find The Area of Any Triangle

Heron's Formula for the area of a triangle(Hero's Formula) A method for calculating the area of a triangle when you know the lengths of all three sides. Let a,b,c be the lengths of the sides of a triangle. Heron's formula states that the…

## [C/C++] Program to Find Greatest Among Three Numbers

This program shows the greatest number between three numbers using if-else-if statement. It takes three numbers as input from user and output the greatest number. C Code #include <stdio.h> int main() { float a, b, c;…

## [C/C++] Program to Find The Perimeter And Area of a Rectangle

Formulas: Area of rectangle: height*width Perimeter of rectangle: 2*(height+width) C Code #include<stdio.h> #include<conio.h> void main() { float width,height,area,perimeter; printf("Enter Width of Rectangle:…

## [C/C++] Program to Convert Decimal Number in Binary

A simple c and c++ program to convert a decimal number into binary number system. C/C++ program to convert base ten number system into base two number system or 0's and 1's format. Program is simple and it just convert simple integers…

## [C/C++] Program to Find Factorial Using All Loops

A simple c and c++ program to find factorial of given number. Factorial of a number is product of all previous number from 1 to that number and it's denoted by n! . Example if you want to find the product of 5 it'll be factorial=…

## [C/C++] Program to Convert Time in 12 OR 24 Hours

A simple c and c++ program to convert 12 hours time into 24 hours and 24 hours time in 12 hours and display both as output. C Code #include <stdio.h> #include<stdio.h> #include<conio.h> void main() { int…

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More