0% found this document useful (0 votes)
16 views12 pages

Journal 1

The document contains a series of C++ programs that demonstrate various programming concepts, including printing biodata, performing mathematical operations, calculating areas and circumferences, converting units, and checking conditions such as even/odd or positive/negative. Each program is structured with input prompts and output statements to guide users through the functionality. The examples cover a wide range of basic programming tasks suitable for beginners.

Uploaded by

khushiptl1566
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views12 pages

Journal 1

The document contains a series of C++ programs that demonstrate various programming concepts, including printing biodata, performing mathematical operations, calculating areas and circumferences, converting units, and checking conditions such as even/odd or positive/negative. Each program is structured with input prompts and output statements to guide users through the functionality. The examples cover a wide range of basic programming tasks suitable for beginners.

Uploaded by

khushiptl1566
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

1. Write a program to print your biodata.

#include<iostream.h>
#include<stdio.h>
void main()
{
clrscr();
cout<<"--------";
cout<<"23bca223":
cout<<"sybca div-";
cout<<"adderss:20,sai darshan row house,bardoli";

cout<<"ta:bardoli";

cout<<"di:surat";

getch();

2. Write a program to perform mathematical operation. (Add, Sub, Mul, div,

modules)

#include<iostream.h>

#include<conio.h>

void main()

clrscr();

int a,b,c;

cout<<"enter a first value";

cin>>a;

cout<<"enter a second value";

cin>>b;

c=a+b;

c=a-b;

c=a*b;

c=a/b;
c=a%b;

cout<<"sum of two value"<<a+b<<endl;

cout<<"sub of two value"<<a-b<<endl;

cout<<"mul of two value"<<a*b<<endl;

cout<<"div of two value"<<a/b<<endl;

cout<<"module of two value"<<a%b<<endl;

getch();

3.Write a program to find the Area and Circumference of a Circle.

#include<iostream.h>
#include<conio.h>
void main()
{
float r,c,a,pi;
cout<<"enter a redius";
cin>>r;
a=pi*r*r;
c=2*pi*r;
cout<<"the area of circle is:"<<a<<endl;
cout<<"the circumference of the circle is:"<<c<<endl;
getch();
}

4. Write a program to print ASCII Value of the Character.

#include<iostream.h>

#include<conio.h>

void main()

char ch;

clrscr();

cout<<"enter a character:";

cin>>ch;

cout<<"ASCI value of"<<ch<<"is"<<int(ch)<<endl;

getch();
}

5. Write a program find the Area of a Triangle.

#include<iostream.h>

#include<conio.h>

void main()

clrscr();

float b,h,area;

b=4;

h=10;

area=(b*h)/2;

cout<<"area of triangle is:"<<area;

getch();

6. Write a program to convert dollar in to rupees.

#include<iostream.h>

#include<conio.h>

void main()

int D,R;

cout<<"Enter a any value for dollar";

cin>>D;

R=D*83;

cout<<R<<"Ruppes";

getch();

7. Write a program to convert gram into kilogram.

#include<iostream.h>

#include<conio.h>
void main()

float gram,kilogram;

clrscr();

cout<<"enter weight in gram:";

cin>>gram;

kilogram=gram/1000.0;

cout<<"weight in kilogram:"<<kilogram<<"kg"<<endl;

getch();

8. Write a program to calculate a Simple Interest

#include<iostream.h>

#include<conio.h>

void main()

float p,r,t,i;

cout<<"enter a principali amount:";

cin>>p;

cout<<"enter the value of rate:";

cin>>r;

cout<<"enter the value of time:";

cin>>t;

i=(p*r*t)/100;

cout<<"simple interest="<<i<<endl;

getch();

9. Convert Temperature Celsius into Fahrenheit

#include<iostream.h>

#include<conio.h>
void main()

float c,f;

clrscr();

c=32;

f=c*(9/5)+32;

cout<<"\n convert c into f is:"<<f;

getch();

10.Write a program to find Greater No. Among the Given Three Number

#include<iostream.h>

#include<conio.h>

void main()

int a,b,c,gret=0;

clrscr();

cout<<"enter three values:";

cin>>a>>b>>c;

gret=(a>b)?((a>c)?a:c):((b>c)?b:c);

cout<<"the grater no is:"<<gret;

getch();

11.Write a program to find the Gross Salary of an Employee

#include<iostream.h>

#include<conio.h>

void main()

clrscr();

float grosspayment,basic,da,hra;
cout<<"enter basic salary:";

cin>>basic;

cout<<"enter da:";

cin>>da;

cout<<"enter hra:";

cin>>hra;

da=(da*basic)/100;

hra=(hra*basic)/100;

grosspayment=basic+da+hra;

cout<<"\n gross salary:"<<grosspayment<<endl;

getch();

12.Write a program to Calculate the Percentage and Grade of 5 Subjects.

#include<iostream.h>

#include<conio.h>

void main()

clrscr();

float mil,stat,python,oops,wd,total,average,percentage;

char grade;

cout<<"enter the marks of five subject:";

cin>>mil>>stat>>python>>oops>>wd;

total=mil+stat+python+oops+wd;

average=total/5.0;

percentage=(total/500.0)*100;

if(average>=90)

grade='A';

else if(average>=80&&average<90)

grade='B';
else if(average>=70&&average<80)

grade='C';

else if(average>=60&&average<70)

grade='D';

else

grade='E';

cout<<"\n the total marks:"<<total<<endl;

cout<<"the average marks:"<<average<<endl;

cout<<"the percentage:"<<percentage<<endl;

cout<<"the grade:"<<grade<<endl;

getch();

13.Write a Program to Display the Size of the Different Datatype.

#include<iostream.h>

#include<conio.h>

void main()

clrscr();

char a;

int b;

float c;

double d;

cout<<sizeof(a)<<endl;

cout<<sizeof(b)<<endl;

cout<<sizeof(c)<<endl;

cout<<sizeof(d)<<endl;

getch();
}

14.Write a Program to Check Number is Positive or Negative

#include<iostream.h>

#include<conio.h>

void main()

clrscr();

int no;

cout<<"enter a no";

cin>>no;

if(no>0)

cout<<"no is positive";

else

cout<<"no is negative";

getch();

15.Write a Program to Checking You Are Eligible for Voting or Not

#include<iostream.h>

#include<conio.h>

void main()

int age;

cout<<"enter your age";

cin>>age;
if(age>=18)

cout<<"you are elegible for voting";

else

cout<<"you are elegible for voting";

};

16.Write a Program to Checking Number Is Even or Odd

#include<iostream.h>

#include<conio.h>

void main()

int no;

clrscr();

cout<<"enter a any no";

cin>>no;

if(no%2==0)

cout<<"no is even";

else

cout<<"nois odd";

getch();

17.Write a Program to Check Year is Leap Year or Not\


#include<iostream.h>

#include<conio.h>

void main()

clrscr();

int y;

cout<<"enter any year:";

cin>>y;

if(y%400==0||y%4==0&&y%100!=0)

cout<<"year is leapyear";

else

cout<<"year is not leap year";

getch();

18.Program to Check Character Is Uppercase, Lowercase Alphabet or a

Digit or a Special Symbol

#include<iostream.h>

#include<conio.h>

void main()

clrscr();

char a;

cout<<"enter a character:";

cin>>a;

if(a>=65&&a<=90)
{

cout<<"upper case latter";

else if(a>=97&&a<=122)

cout<<"lower case latter";

else if(a>=48&&a<=57)

cout<<"digit";

else

cout<<"symbol";

getch();

19.Write a program find the Character Is Vowel or Not

#include<iostream.h>

#include<conio.h>

void vowelorconsonant(char x)

clrscr();

if(x=='a'||x=='e'||x=='i'||x=='o'||x=='u'||x=='A'||x=='E'||x=='I'||x=='O'||x=='U')

cout<<"vowel"<<endl;

else

cout<<"consonant"<<endl;

int main()

vowelorconsonant('c');
getch();

return 0;

20.Read Integer N and Print the First Three Powers (N^1, N^2, N^3)

#include<iostream.h>

#include<conio.h>

#include<math.h>

void main()

clrscr();

int n;

cout<<"enter an integer:";

cin>>n;

cout<<n<<"^1="<<pow(n,2)<<endl;

cout<<n<<"^2="<<pow(n,2)<<endl;

cout<<n<<"^3="<<pow(n,3)<<endl;

getch();

You might also like