Learning c++
/*//Write a program to make a simple calculator.
int num1,num2;
cout<<"Enter the first operand : ";
cin>>num1;
cout<<"Enter the second operand : ";
cin>>num2;
char operator23;
cout<<"Enter the operator (+,-,*,/) : ";
cin>>operator23;
int addition = num1+num2;
int subtraction = num2-num1;
int multiplication = num1*num2;
int division = num2/num1;
switch (operator23)
{
case '+' : cout<< "Sum is : "<<addition;
break;
case '-' : cout<< "Difference is : "<<subtraction;
break;
case '*' : cout<< "Product is : "<<multiplication;
break;
case '/' : cout<< "Quotient is : "<<division;
break;
default:cout<<"invalid operator !!";
break;
}
// Write a program to print the table of : n
int n;
cout<<"Enter the number to print the table of : ";
cin>>n;
for (int i = 0; i <11; i++)
{
int table = n*i;
cout<<table<<endl;
}
// array in c++
//int a[5]={56,45,33,344,43};
//cout<<a[2];
// miltidimensional array;
int b[2][4][2]={{34,54},{45,33,22,45}};
cout<<b[0][1];
// write a program to print the odd numbers bitween 1 to n;
cout<<"Enter the last term upto which you have to find the entegers : ";
int n;
cin>>n;
for(int i = 0;i<=n;i++){
if(i%2==1){
cout<<i<<endl;
}
}
// write a program to find the factors of given integers :
int number = 15;
for(int i =0;i<=number;i++){
if(number%i==0){
cout<<i<<endl;
}
}
*/
//Write a program to check weather the give integer is prime or not ;
// Write a program to wish someone by taking her name from keyboard.
char name[100] = {0} ;
cout<<"Plz enter your name : ";
cin.getline(name,100);
cout<<"I love you "<<name<<endl;
Comments
Post a Comment