Program of Fibonacci Series in C++

#include<iostream>
using namespace std;
int main()
{
int x=0,y=1,z,i,t;
cout<<"enter any number\n";
cin>>z;
cout<<x<<endl;
for(i=2;i<z;i++)
{
t=x+y;
cout<<t<<endl;
y=x;
x=t;
}
getch();
}

Programming in C++ Printing your name or string without semicolon

#include<iostream>
#include<conio.h>

using namespace std;
int main()
{
if(cout<<"mittu parmar"&&getch())
{
}
}

Programming in C++ Swapping two number without third variable

#include<iostream>
using namespace std;
int main()
{
int a,b;
cout<<"enter two numbers\n";
cin>>a;
b=a;
cin>>a;
cout<<"swap of two no. is\n"<<a<<b;
}

Programming in C++ Swapping of two Integers

#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cout<<"enter two numbers\n";
cin>>a>>b;
c=a;
a=b;
b=c;
cout<<"swap of two no. is\n"<<a<<b;
}

how to find smallest number in array in c++

how to find smallest number in array in c++

#include<iostream>
using namespace std;
main()
{
cout<<"enter 10 numbers for find smallest number from 10 numbers\n";
int a[10],i;
for(i=0;i<10;i++)
cin>>a[i];
int small=a[0];
for(i=0;i<10;i++)
if(a[i]>a[i+1])
small=a[i+1];
cout<<"smallest number is\n";
cout<<small;
}

how to cheak biggest number of array in c++

programme for cheak biggest number of array in c++


#include<iostream>
using namespace std;
main()
{
cout<<"enter 10 numbers for find biggest number from 10 numbers\n";
int a[10],i;
for(i=0;i<10;i++)
cin>>a[i];
int max=0;
for(i=0;i<10;i++)
if(a[i]>max)
max=a[i];
cout<<"biggest number is\n";
cout<<max;
}

how to print pyramid in java

//how to print pyramid in java

class Pyramid
{
    public static void main(String []args)
    {
   int i,j,k,l;
   for(i=1;i<11;i++)
       {
for(k=11;k>i;k--)
System.out.print(" ");

for(j=1;j<i;j++)
System.out.print("*");

for(l=0;l<i;l++)
System.out.print("*");

   System.out.println();
   }
    }
}


output


how to pint pyramid in c++

//programme for print pyramid in c++ 


#include<iostream>
using namespace std;
main()
{
int i,j,k,l;
for(i=1;i<11;i++)
{
for(k=11;k>i;k--)
cout<<" ";

for(j=1;j<i;j++)
cout<<"*";

for(l=0;l<i;l++)
cout<<"*";

cout<<endl;
}
}

output


programme for cheak number is prime or not in java

//programme for cheak number is prime or not in java 

class Prime
{   
    public static void main(String args[])
    {
    int n=8,i,f=0;
        
    for(i=2;i<=n;i++)
        if(n%i==0)
        {
            f=1;
            break;
        }
    if(f==1&&i==n)
        System.out.println(n+" is prime number");
    else
        System.out.println(n+" is not prime number");
    }
}

output




what is constructor
this is one of special method of any class in java
it's name will same to class name

like this-------

class Demo      ------------this is class name
{
Demo       ------------this is constrator name
{

}
}

mainly we use it for initialise variables
it can be parameterized
and it can be default

It make automatic called when we maked object of any class
when we do not maked it then java will maked it autometic

programme for armstrong number for 3 digit in java

armstrong number import java.util.Scanner; class Mittu {     public static void main(String []args)     {         Scanner s=new Sca...