c++ practice session
#include <iostream>
//#include<bits/stdc++.h>
#include <iomanip>
using namespace std;
int main(){
/*
char character ;
cout<<"Enter Your character : ";
cin>>character;
if(character>='a' && character<='z'){
cout<<"This is small case.;"<<endl;
}
else if(character>='A' && character<='Z' ){
cout<<"This is upper case."<<endl;
}
else if(character>='1' && character <='9'){
cout<<"This is digit."<<endl;
}
// Find the sum of even numbers upto n ;
int n;
cin>>n;
int sum=0;
for (int i = 0; i <=n; i++)
{
if(i%2==0){
sum=sum+i;
}
}
cout<<"sum is : "<<sum<<endl;
// write a program to find the entered number is prime or not ;
// write a program to test weather a person can vote or not by taking his age as a input;
cout<<"enter your age : ";
int age ;
cin>>age;
if (age>=18)
{
cout<<"You can vote";
}
else{
cout<<"You can't vote!!";
}
// Write a program to print the table of given integer;
// Write a java program to print the table of given integers:
int n ;
cout<<"enter the integer to print the table of : ";
cin>>n;
for(int i = 0; i<11;i++){
cout<<n*i<<endl;
}
// write a program to find the factors of given integers:
int num;
cout<<"Enter the integer to find the factors of : ";
cin>>num;
for (int i = 0; i <=num; i++)
{
if(num%i==0){
cout<<i<<endl;
}
}
// write a java program to check weather the entered number is odd or even:
int number;
cout<<"Enter the number to check weather it is odd or even: "<<endl;
cin>>number;
if(number%2==0){
cout<<"it is even number "<<endl;
}
else{
cout<<"its a odd number"<<endl;
}
// write a program to find the greatest number among given integers;
int num1,num2;
cout<<"enter the first integer:";
cin>>num1;
cout<<"enter the second integer:";
cin>>num2;
if(num1>num2){
cout<<num1<<"is greater than"<<num2;
}
else{
cout<<num2<<"is greater than"<<num1;
}
*/
int n ;
cout<<"enter the integer to print the table of : ";
cin>>n;
for(int i = 0; i<11;i++){
cout<<n*i<<endl;
}
return 0;
}
Comments
Post a Comment