learning c++ is fun
#include <iostream>
using namespace std;
int main()
{
/*Q- Write a c++ program to input a dividend and divisor and calculate and display
the quotient and remainder
*/
/* int divisor, dividend,quotient,remainder;
cout<<"Enter the dividend" <<endl;
cin>>dividend;
cout<<"Enter the divisor" <<endl;
cin>>divisor;
quotient = dividend/divisor;
cout<<"Quotient: "<<quotient <<endl;
remainder = dividend % divisor;
cout<<"Remainder: "<<remainder;*/
/* Write the c++ program to calculate the area of triangle ?
float height, base , area ;
cout<<"Enter height of the triangle ";
cin>>height;
cout<<"Enter lenght of base of the triangle ";
cin>>base;
area = (base*height)/2;
cout<<"Area of triangle is : "<<area;*/
/*Write a c++ program to accept a number and display whether it is divisible by 2 and 3 or not ?
int num, to_check1, to_check2, checking ;
cout<<"Enter the number : ";
cin>>num;
to_check1 = num%2;
to_check2 = num%3;
checking = (to_check1==0)&&(to_check2==0);
cout<<checking;*/
// ----------------------->OR<----------------------------
cout<<"Whats your name ? ";
cout<<endl;
string name;
cin>>name;
cout<<"I love You " <<name;
}
Comments
Post a Comment