Write a program to print n steps of a Fibonacci series using for loop Code in Java Programming
Write a program to print n steps of a Fibonacci series using for loop Code in Java Programming:
import java.util.*;
class fibonacci
{
public static
void main(String args[])
{
int t,a,b,n;
/* Syntax */ Scanner
scanner name=new Scanner(System.in);
/* Syntax */ System.out.print("Enterd Numberd ");
n=sc.nextInt();
a=1;
b=1;
for(t=0;t<=n;t=a+b)
{
System.out.print(t
+ ",");
a=b;
b=t;
}
}
}
Write a program that uses all the escape sequences to print the characters code in Java Programming
import java.util.*;
import java.io.*;
class q2
{
public static
void main(String args[ ])
{
System.out.println("escape
character sequences ");
System.out.println("\\n-new
line escape character sequences");
System.out.println("\\t-horizontal
tab escape character sequences");
System.out.println("\\b-back
space escape character sequences");
System.out.println("\\v-vertical
tab escape character sequences");
System.out.println("\\f-form
feed escape character sequences");
System.out.println("\\a-alert
noise escape character sequences");
System.out.println("\\o-optical escape character sequences");
System.out.println("\\r- escape character sequences");
System.out.println("\\q-question
mark escape character sequences");
}
}
Note: *Remove The Sentence on this program ___(Don't Missing Syntax required).
Note: *Remove The Sentence on this program ___(Don't Missing Syntax required).
write a program to swastika Triangle in C++
• Write a program to print following triangle. (Use getdata() for get n value & display() for print triangle) Get input from user to print n number of line. e.g(n=5) .
*
**
***
****
*****
#include<iostream.h>
#include<conio.h>
class swastik
{
int i,j,k,m,n;
public:
swastikdisp()
{
cout<<"\n\n\t";
for(i=0;i<7;i++)
{
cout<<"*";
}
cout<<endl;
for(j=0;j<6;j++)
{
cout<<"*\t*\n";
}
//cout<<"\n";
for(k=0;k<17;k++)
{
cout<<"*";
}
cout<<endl;
for(n=0;n<6;n++)
{
cout<<"\t*\t*\n";
}
cout<<" ";
for(m=0;m<6;m++)
{
cout<<"*";
}
cout<<"*";
}
};
void main()
{
clrscr();
swastik s;
s.swastikdisp();
getch();
}
Note: *Remove The Sentence on this program ___(Don't Missing Syntax required).
Note: *Remove The Sentence on this program ___(Don't Missing Syntax required).
write a program to Take number from user and print that number into reverse Using proper function in C++
#Header File include#include<stdio.h>
#Header File include#include<conio.h>
#Header File include#include<iostream.h>
class rev
{
private :
int no;
public:
rev(int
n1)
{
no=n1;
}
void
cal()
{
int
a,s=0;
while(no>=1)
{
a=no%10;
s=(s*10)+a;
no=no/10;
}
cout<<"\nThe Reveres number are"<<s; ___(Don't Missing Syntax required).
}
};
void main()
{
int num;
clrscr();
cout<<"Enter
number to check revers number are:"; ___(Don't Missing Syntax required).
cin>>num;
rev r(num);
r.cal();
getch();
}
Note: *Remove The Sentence on this program ___(Don't Missing Syntax required).
write a program code Print Fibonacci series Using proper function in C++
Header File include#include<stdio.h>
Header File include#include<conio.h>
Header File include#include<iostream.h>
class fibo
{
private :
int
n,a,b,t;
public :
fibo(int
no1)
{
n=no1;
a=0,b=1,t=0;
}
void
fiboc()
{
int
i=1;
cout<<"\nFibonacci
Series :"; ___(Don't Missing Syntax required).
while(i<=n)
{
a=b;
b=t;
t=a+b;
cout<<"
"<<t; ___(Don't Missing Syntax required).
i++;
}
}
};
void main()
{
int no1;
clrscr();
cout<<"Enter
number up to :"; ___(Don't Missing Syntax required).
cin>>no1;
fibo s1(no1);
s1.fiboc();
getch();
}
Note: *Remove The Sentence on this program ___(Don't Missing Syntax required).
Make full mark sheet Program Code in C++ using turbo c editor.(Use appropriate data member and member function)
#include<stdio.h> ___(Don't Missing Syntax required).
#include<conio.h> ___(Don't Missing Syntax required).
#include<iostream.h> ___(Don't Missing Syntax required).
class student
{
int
no,s1,s2,s3,tot,per;
char
*name;
char div;
public:
student(int
num,char *nm,char d,int n1,int n2,int n3) ___(Don't Missing Syntax required).
{
no=num;
name=nm;
div=d;
s1=n1;
s2=n2;
s3=n3;
tot=s1+s2+s3;
per=tot/3;
}
void
total()
{
cout<<"\n-----------------Marksheet---------------"<<endl; ___(Don't Missing Syntax required).
cout<<"\n
Student No :"<<no<<endl;
cout<<"\n
Student Name :"<<name<<endl;
cout<<"\n
Division :"<<div<<endl;
cout<<"\n
Subject1 Mark :"<<s1<<endl;
cout<<"\n
Subject2 Mark :"<<s2<<endl;
cout<<"\n
Subject3 Mark :"<<s3<<endl;
cout<<"\n
Total :"<<tot<<endl;
cout<<"\n
Percentage :"<<per<<endl;
}
void
grade() ___(Don't Missing Syntax required).
{
if(per>=70)
{
cout<<"\n
Grade : Distiction"<<endl; ___(Don't Missing Syntax required).
}
else
if(per>=60)
{
cout<<"\n
Grade : First"<<endl; ___(Don't Missing Syntax required).
}
else
if(per>=48)
{
cout<<"\n
Grade : Second"<<endl; ___(Don't Missing Syntax required).
}
else
if(per>=40)
{
cout<<"\n
Grade : Pass"<<endl;
}
else
{
cout<<"\n
Grade : Fail"<<endl; ___(Don't Missing Syntax required).
}
cout<<"\n....................................."<<endl; ___(Don't Missing Syntax required).
}
};
void main()
{
int
no,n1,n2,n3;
char *nam;
char divi;
clrscr();
cout<<"\n
Enter Student No.: "; ___(Don't Missing Syntax required).
cin>>no;
cout<<"\n
Enter Student Name :"; ___(Don't Missing Syntax required).
cin>>nam;
cout<<"\n
Enter Your Division :"; ___(Don't Missing Syntax required).
cin>>divi;
cout<<"\n
Enter Subject1 Mark :"; ___(Don't Missing Syntax required).
cin>>n1;
cout<<"\n
Enter Subject2 Mark :"; ___(Don't Missing Syntax required).
cin>>n2;
cout<<"\n
Enter Subject3 Mark :"; ___(Don't Missing Syntax required).
cin>>n3;
student
s(no,nam,divi,n1,n2,n3);
s.total();
s.grade();
getch();
}
Note: *Remove The Sentence on this program ___(Don't Missing Syntax required).
Note: *Remove The Sentence on this program ___(Don't Missing Syntax required).
Take Employee information like, Emp_Id, Emp_Name, Emp_design,Emp_Salary with the help of the function and display with appropriate function Programing code in c++
#include<iostream.h> ___(Don't Missing Syntax required).
#include<conio.h>
#include<stdio.h>
#include<string.h>
class employe
{
int empno;
char name[20];
char *desig;
float
empsal,emphra,empda,empta,emppf,empgsal;
public:
employe(int
no,char na[],char *des,float sal,float hra,float da,float ta,float pf)
{
empno=no;
strcpy(name,na);
desig=des;
empsal=sal;
emphra=hra;
empda=da;
empta=ta;
emppf=pf;
empgsal=0;
}
employe(employe
&s)
{ empno=s.empno;
strcpy(name,s.name);
desig=s.desig;
empsal=s.empsal;
emphra=s.emphra;
empda=s.empda;
empta=s.empta;
emppf=s.emppf;
empgsal=s.empgsal;
}
void
putdata()
{
float
hra=0;
hra=empsal*emphra/100;
float
da=0;
da=empsal*empda/100;
float
ta=0;
ta=empsal*empta/100;
float
pf=0;
pf=empsal*emppf/100;
empgsal=empsal+hra+da+ta-pf;
cout<<"..............Employe
Info............."<<endl;
cout<<"\n
Employe Number :"<<empno<<endl;
cout<<"\n
Employe Name: "<<name<<endl;
cout<<"\n
Employe Designation :"<<desig<<endl;
cout<<"\n
Employe Basic Salary: "<<empsal<<endl;
cout<<"\n
HRA :"<<hra<<endl;
cout<<"\n
DA :"<<da<<endl;
cout<<"\n
TA :"<<ta<<endl;
cout<<"\n
Pf :"<<pf<<endl;
cout<<"\n
Employe Net Salary :"<<empgsal<<endl;
cout<<"\n.......................................\n\n";
}
};
void main()
{
float
no,salary,hra,da,ta,pf;
char
nam[20],*desig;
clrscr();
cout<<"\nEnter
Employe Number:";
cin>>no;
cout<<"\nEnter
Employe Name :";
cin>>nam;
cout<<"\nEnter
Employe Designation :";
cin>>desig;
cout<<"\nEnter
Empoye Basic Salary :";
cin>>salary;
cout<<"\nEnter
HRA in % :";
cin>>hra;
cout<<"\nEnter
DA in % :";
cin>>da;
cout<<"\nEnter
TA in % :";
cin>>ta;
cout<<"\nEnter
PF in % :";
cin>>pf;
employe
s1(no,nam,desig,salary,hra,da,ta,pf);
employe s2(s1);
s1.putdata();
s2.putdata();
getch();
}
Note: *Remove The Sentence on this program ___(Don't Missing Syntax required).
Subscribe to:
Posts
(
Atom
)