week 1:- simple interest /compound interest.
#include<iostream>
#include<math.h>
using namespace std;
int main ()
{
double a,b,c,d,si,com;
cout<<"enter 1 for simple intrest and enter 2 for compound intrest :";
cin >>d;
if(d==1)
{
cout<< "\nyou selected simple intrest"<<endl<<endl;
cout <<"enter the principle :";
cin >>a;
cout <<"enter the rate :";
cin >>b;
cout <<"enter the time :";
cin >>c;
si= a*b*c/100;
cout << "your simple intrest is :"<<si<<endl;
}
else if (d==2)
{
cout<< "\nyou selected compound intrest"<<endl<<endl;
cout <<"enter the principle :";
cin >>a;
cout <<"enter the rate :";
cin >>b;
cout <<"enter the time :";
cin >>c;
com = a* pow ((1+b/100),c) -a;
cout << "your compound intrest is"<<com<<endl;
}
else
cout <<"entered the wrong details";
}
week 1:- find Celsius to fahrenheit / fahrenheit Celsius.
#include <iostream>
using namespace std;
int main()
{ int a;
cout<<"enter 1 for fahrenheit to celius and 2 for celius to fahrenheit :";
cin>>a;
if (a == 1)
{
float fahren, celsius;
cout << "Enter the temperature in fahrenheit\n";
cin >> fahren;
celsius = 5 * (fahren - 32) / 9;
cout << fahren <<" Fahrenheit is equal to " << celsius <<" Centigrade\n";
}
else if(a == 2)
{
float fah, cel;
cout << "Enter the temperature in celsius\n";
cin >> cel;
fah =(9.0/5.0) * cel + 32;
cout << cel <<"Centigrade is equal to " << fah <<"Fahrenheit\n";
}
else
{
cout<<"\nentered wrong number";
}
return 0;
}
week 1:- grade/scorecard of student (array)
#include<iostream>
#include<string.h>
using namespace std;
int main ()
{
int marks[5],c,d,total,b,greatest_so_far;
float avr;
char name[40];
cout<<"\nenter Your Name :";
cin>>name;
cout<<"\nenter your Registration number :";
cin>>b;
cout<<"\nenter Your Year of Joining :";
cin>>c;
cout<<"\nenter Your Semester :";
cin>>d;
cout << "Enter 5 numbers\n";
for (int i = 0; i<5; i++)
{
cin >> marks[i];
}
greatest_so_far = marks[0];
for (int i = 0; i < 5; i++)
{
if (marks[i] < greatest_so_far)
{
greatest_so_far = marks[i];//storing current greatest no.
}
}
avr = (marks[0]+marks[1]+marks[2]+marks[3]+marks[4]);
total= avr/5;
/*or
cout<<"marks in five subjects"<<endl<<endl;
cout<<"Object Oriented Programming & Design :"<<endl<<endl;
cin>>marks[0];
cout<<"ADBMS :"<<endl<<endl;
cin>>marks[1];
cout<<"ADSA :"<<endl<<endl;
cin>>marks[2];
cout<<"Computational Mathematics :"<<endl<<endl;
cin>>marks[3];
cout<<"SEPM :"<<endl<<endl;
cin>>marks[4];
*/
cout<<"-----------------------------------------------------------------------------------------------------------";
cout <<"\n\n\t\t\t\t\t Score Card for Student :"<<name<<endl<<endl<<endl;
cout <<"\tRegistration Number :"<<b<<"\t";
cout <<"semester :"<<c;
cout <<"\t\t\tYear :"<<d<<endl<<endl;
cout<<"\tgrade assined"<<endl<<endl;
cout<<"\tSerial no. ";
cout <<"\t\t\t Subject Name ";
cout <<"\t\t\tmarks scored(out of 100)";
cout<<"\n-----------------------------------------------------------------------------------------------------------";
cout << " \t 1 \t\t Object Oriented Programming & Design \t\t\t" <<marks[0] << endl;
cout << "\t 2 \t\t ADBMS \t\t\t\t\t\t\t" << marks[1] << endl;
cout << "\t 3 \t\t ADSA \t\t\t\t\t\t\t" << marks[2]<< endl;
cout << "\t 4 \t\t Computational Mathematics \t\t\t\t" <<marks[3]<< endl;
cout << "\t 5 \t\t SEPM \t\t\t\t\t\t\t" <<marks[4]<< endl;
avr = (marks[0]+marks[1]+marks[2]+marks[3]+marks[4]);
total= avr/5;
cout << "\t\t\t\t\t\t\t\t\tTotal :" << avr<< endl;
cout << "\t\t\t\t\t\t\t\t\tAverage :" << total<<"%"<< endl;
if (greatest_so_far >= 33)
{
if (total >=90 && total<=100)
{
cout <<"\t\t\t\t\t\t\t\t\tgrade 'A' ";
}
else if (total >=80 && total<=89)
{
cout <<"\t\t\t\t\t\t\t\t\tgrade 'B' ";
}
else if (total >=61 && total<=79)
{
cout <<"\t\t\t\t\t\t\t\t\tgrade 'C' ";
}
else if (total >=52 && total<=59)
{
cout <<"\t\t\t\t\t\t\t\t\tgrade 'D' ";
}
else if (total >=41 && total<=49)
{
cout <<"\t\t\t\t\t\t\t\t\tgrade 'E' ";
}
else
cout<< " \t\t\t\t\t\t\t\t\tgrade 'fail' ";
}
else
cout<< " \t\t\t\t\t\t\t\t\tgrade 'fail' ";
return 0;
}
week 1:- grade/scorecard of student (structure)
#include<iostream>
#include<string.h>
using namespace std;
struct student
{
float sone,stwo,sthree,sfour,sfive;
};
int main ()
{
double marks,c,d,total,avr;
int b;
char name[40];
cout<<"\nenter Your Name :";
cin>>name;
cout<<"\nenter your Registration number :";
cin>>b;
cout<<"\nenter Your Year of Joining :";
cin>>c;
cout<<"\nenter Your Semester :";
cin>>d;
student s;
cout<<"marks in five subjects"<<endl<<endl;
cout<<"Object Oriented Programming & Design :"<<endl<<endl;
cin>>s.sone;
cout<<"ADBMS :"<<endl<<endl;
cin>>s.stwo;
cout<<"ADSA :"<<endl<<endl;
cin>>s.sthree;
cout<<"Computational Mathematics :"<<endl<<endl;
cin>>s.sfour;
cout<<"SEPM :"<<endl<<endl;
cin>>s.sfive;
cout<<"-----------------------------------------------------------------------------------------------------------";
cout <<"\n\n\t\t\t\t\t Score Card for Student :"<<name<<endl<<endl<<endl;
cout <<"\tRegistration Number :"<<b;
cout <<"\t\t\tsemester :"<<c;
cout <<"\t\t\tYear :"<<d<<endl<<endl;
cout<<"\tgrade assined"<<endl<<endl;
cout<<"\tSerial no. ";
cout <<"\t\t\t Subject Name ";
cout <<"\t\t\tmarks scored(out of 100)";
cout<<"\n-----------------------------------------------------------------------------------------------------------";
cout << " \t 1 \t\t Object Oriented Programming & Design \t\t\t" << s.sone << endl;
cout << "\t 2 \t\t ADBMS \t\t\t\t\t\t\t" << s.stwo << endl;
cout << "\t 3 \t\t ADSA \t\t\t\t\t\t\t" << s.sthree<< endl;
cout << "\t 4 \t\t Computational Mathematics \t\t\t\t" << s.sfour<< endl;
cout << "\t 5 \t\t SEPM \t\t\t\t\t\t\t" << s.sfive<< endl;
avr = (s.sone+s.stwo+s.sthree+s.sfour+s.sfive);
total= avr/5;
cout << "\t\t\t\t\t\t\t\t\tTotal :" << avr<< endl;
cout << "\t\t\t\t\t\t\t\t\tAverage :" << total<<"%"<< endl;
if (total >=90 && total<=100)
{
cout <<"\t\t\t\t\t\t\t\t\tgrade 'A' ";
}
else if (total >=80 && total<=89)
{
cout <<"\t\t\t\t\t\t\t\t\tgrade 'B' ";
}
else if (total >=61 && total<=79)
{
cout <<"\t\t\t\t\t\t\t\t\tgrade 'C' ";
}
else if (total >=52 && total<=59)
{
cout <<"\t\t\t\t\t\t\t\t\tgrade 'D' ";
}
else if (total >=41 && total<=49)
{
cout <<"\t\t\t\t\t\t\t\t\tgrade 'E' ";
}
else
cout<< " \t\t\t\t\t\t\t\t\tgrade 'fail' ";
}
Comments
Post a Comment