HTML Tutorial || Networking Assignment || Computer Full Forms || Ms-Office Shortcut Keys || Ms-Office Notes || Number System Notes || Internet Assignment
JavaScript Tutorial || CSS Tutorial || Operating System Notes || History of Computer Assignment || Netwoking Notes || Computer Fundamentals Notes

C program to Convert Days into Years, Weeks and Days ?


Q:- Write a C Program to Convert Days into Years, Weeks and Days ?
Input
#include<stdio.h>
#include<<conio.h>
int main()
{
int days,years,weeks;
clrscr();
printf(“Enter a Number of Days=”);
scanf(“%d”,&days);
years=(days/365);
weeks=(days%365)/7;
days=days-((years*365)+(weeks*7));
printf(“Years=%d\n”,years);
printf(“Weeks=%d\n”,weeks);
printf(“Days=%d\n”,days);
getch();
}


Output

Enter a Number of days = 373
Years = 1
Weeks = 1
Days = 1

C Program to Enter P,T,R and Calculate Compound Interest ?


Q:- Write a C Program to Enter P,T,R and Calculate Compound Interest ?
Input

#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
float principle,time,rate,ci;
clrscr();
printf("Enter Principle (Amount) =");
scanf("%f",&principle);
printf("Enter Time =");
scanf("%f",&time);
printf("Enter Rate =");
scanf("%f",&rate);
ci=()principle*time*rate/100;
printf("Compound Interest =%.2f",ci);
getch();
       }


Output

Enter principle(Amount) = 1200
Enter Time = 2
Enter Rate = 5.4
Compound Interest = 129.60

C Program to Enter P,T,R and Calculate Simple Interest ?


Q:- Write a C Program to Enter P,T,R and Calculate Simple Interest ?
Input

#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
float principle,time,rate,si;
clrscr();
printf("Enter Principle (Amount) =");
scanf("%f",&principle);
printf("Enter Time =");
scanf("%f",&time);
printf("Enter Rate =");
scanf("%f",&rate);
si=()principle*time*rate/100;
printf("Simple Interest =%.2f",si);
getch();
       }


Output

Enter principle(Amount) = 1200
Enter Time = 2
Enter Rate = 5.4
Simple Interest = 129.60

C Program to Enter Marks of Five Subjects and calculate Total, Average and Percentage ?


Q:- Write a C Program to Enter Marks of Five Subjects and Calculate Total, Average and  
        Percentage ?
Input

#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
float eng,phy,che,math,comp;
float total,average,percentage;
clrscr();
printf("Enter Marks of Five Subjects=");
scanf("%f%f%f%f%f",&eng,&phy,&che,&math,&comp);
total = eng+phy+che+math+comp;
average = total/5.0;
percentage =  (total/500.0)*100;
printf("Total Marks =%.2f",total);
printf("Average Marks =%.2f",average);
printf("Percentage =%.2f",percentage);
getch();
       }


Output

Enter Marks of Five Subjects =
95
76
85
90
89
Total Marks = 435.00
Average Marks = 87.00
Percentage = 87.00%

C Program to calculate Area of an Equilateral Triangle ?


Q:- Write a C Program to Calculate Area of an Equilateral Triangle ?

Input

#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
float side,area;
clrscr();
printf(“Enter Side of an Equilateral Triangle=”);
scanf(“%f”,&side);
area = (sqrt(3)/(4))*(side*side);
printf(“Area of an Equilateral Triangle=%.3f”,area);
getch();
       }


Output

Enter Side of an Equilateral Triangle = 75
Area of an Equilateral Triangle = 2435.69 sq. units