Vous êtes sur la page 1sur 7

1. #include<iostream.

h>
#include<conio.h>
void main()
{
clrscr();
cout<<"WELCOME TO C++ PROGRAMME FILE ";
getch();
}
2. #include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
int i,s,j;
for(i=1;i<=8;i++)
{
cout<<endl;
for(s=i;s<=7;s++)
cout<<" ";
for(j=1;j<=i;j++)
cout<<" i";
}
getch();
}
3.#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a=5,b=7,c;
c=a+b;
cout<<"sum of 5 and 7 is "<< c ;
getch();
}
4.#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,s;
for (i=1;i<=4;i++)
{ cout<<endl;
for(s=i;s<=3;s++)
cout<<" ";
for (j=1;j<=i;j++)
cout<<" "<<i;
}
getch();
}
5.#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
int i,j;
for (i=1;i<=5;i++)

{ cout<<endl;
for (j=1;j<=i;j++)
cout<<i;
}
getch();
}
6.#include<iostream.h>
#include<conio.h>
#include<math.h>
main()
{
clrscr();
int a,b,n;
cout<<"enter the number";
cin>>n>>endle;
b=sqrt(n);
a=b*b;
if(a==n)
cout<<"yes it is a perfect square";
getch();
}
7.#include<iostream.h>
#include<conio.h>
int main()
{
int a,i;
cout<<"Enter any number : ";
cin>>a;
{ for(i=2;i<=20;i=i+2)
cout<<i;
}
get ch();
{
8. #include<iostream.h>
#include<conio.h>
int main()
{
int a,i;
cout<<"Enter any number : ";
cin>>a;
{ for(i=1;i<=20;i=i+2)
cout<<i;
}
get ch();
{
9.#include<iostream>
#include<conio.h>
#include<math.h>
int main()
{
int number, reverse = 0;
cout<<"Input a Number to Reverse and press Enter: ";
cin>> number;
// Taking Input Number in variable number
for( ; number!= 0 ; )
{

reverse = reverse * 10;


reverse = reverse + number%10;
number = number/10;
}
cout<<"New Reversed Number is: "<<reverse;
return 0;
}
10.#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
int a=1,b=1,c,i=0,n;
cout<<"enter the value of n";
cin>>n;
c=a+b;
cout<<"the sreies is";
cout<<" "<<a;
cout<<" "<<b;
cout<<" "<<c;
while(i<n-3)
{ a=b;
b=c;
c=a+b;
cout<<" "<<c;
i++;
}
getch();
}
11.#include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
int i,s;
{ cout<<"enter first no";
cin>>i;
cout<<"enter second no";
cin>>s;
if(i>s)
cout<<i<<"is greater ";
else
cout<<s<<"is greater";
}
getch();
}
12.#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
void main()
{ clrscr();
char str1[]="hello ",str2[]="ajay";
strcat(str1,str2);
cout<<strlen(str2);

getch();
}
13.#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
void main()
{ clrscr();
char str1[]="hello ",str2[]="ajay";
strcat(str1,str2);
puts(str1);
getch();
}
14.#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<ctype.h>
void main()
{ clrscr();
int opt;
cout<<"enter any no or chracter";
opt=getchar();
if(isalpha(opt))
cout<<"this is aphabet";
else
cout<<"this is not aplhabet";
getch();
}
15.#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<ctype.h>
void main()
{ clrscr();
int opt;
cout<<"enter any no or chracter";
opt=getchar();
if(isdigit(opt))
cout<<"this is digit";
else
cout<<"this is not digit";
getch();
}
16.#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<ctype.h>
void main()
{ clrscr();
int opt;
cout<<"enter any no or chracter";
opt=getchar();
if(isupper(opt))

cout<<"this is upper chracter";


else
cout<<"this is not upper chracter";
getch();
}
17.#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<ctype.h>
void main()
{ clrscr();
int opt;
cout<<"enter any no or chracter";
opt=getchar();
if(islower(opt))
cout<<"this is lower chracter";
else
cout<<"this is not lower chracter";
getch();
}
18.#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<ctype.h>
void main()
{ clrscr();
int opt;
cout<<"enter any no or chracter";
opt=getchar();
if(islnum(opt))
cout<<"this is alphanumeric chracter";
else
cout<<"this is not alphanumeric chracter";
getch();
}

19.include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
void main()
{ clrscr();
char pass[]="ajaykumar",npass[8];
cout<<"enter password";
get (npass);
if (strcmp(pass,npass)==0)
{cout<<"corrrect password";
else
cout<<"wrong password";
}
getch();
}
20 #include<iostream.h>

#include<conio.h>
#include<stdio.h>
#include<string.h>
void main()
{ clrscr();
char pass[8];
cout<<"enter word";
get (pass);
str rev(pass);
cout<<"reverse string="<<pass;
}
getch();
}
21 #include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
void main()
{ clrscr();
char pass[20];
cout<<"enter word";
get (pass);
strupr(pass);
cout<<"the upper value is"<<pass;
}
getch();
}
22.#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
void main()
{ clrscr();
char pass[20];
cout<<"enter word";
get (pass);
strlwr(pass);
cout<<"the lower value is"<<pass;
}
getch();
}
23.#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
void main()
{ clrscr();
char line[100];
cout<<"enter word to terminate with ";
cin.getline(line,100,'t');
cout<<line;
}
getch();
24.#include<iostream.h>
#include<conio.h>

#include<math.h>
void main()
{
clrscr();
int i,j;
for (i=1;i<=4;i++)
{ cout<<endl;
for (j=i;j<=3;j++)
cout<<" ";
for(s=1;s<=i;s++)
cout<<i<<" ";
}
getch();
}
25

Vous aimerez peut-être aussi