Program to enter two integers and print the quotient and remainder

#include <iostream.h> #include <conio.h> int main() { clrscr(); int x,y,quotient,remainder; cout << “Enter 2 integers greater than 0 : “; cin>>x>>y; quotient=x/y; remainder=x-(quotient*y); cout << “Quotient of ” << x << ” & ” << y << ” = ” << quotient << “\n”; cout << “Remainder” << ” = ” << remainder << “\n”; … Read more

Program to enter an integer and output its 15 multiples

  #include <iostream.h> #include <conio.h> int main() { clrscr(); int x; cout << “Enter an integer less than 2185 : “; cin>>x; cout << “The first 15 multiples of ” << x << ” are : “; for(int y=1;y<16;y++) cout << “\n” << x << “x” << y << “=” << x*y; getch(); return 0; … Read more

Program to enter your age and print if you should be in grade 10

  #include <iostream.h> #include <conio.h> void main() { clrscr(); int age; cout << “Enter your present age : ” << endl; cin>>age; if(age==16) { cout << “Your present age is ” << age << ” years.” << endl; cout << “You are of the right age for joining grade 10 !” << endl; } else … Read more

Program to enter two integers and find their sum and average

#include <iostream.h> #include <iostream.h> #include <conio.h> void main() { clrscr(); int x,y,sum; float average; cout << “Enter 2 integers : ” << endl; cin>>x>>y; sum=x+y; average=sum/2; cout << “The sum of ” << x << ” and ” << y << ” is ” << sum << “.” << endl; cout << “The average of … Read more

C++ program which adds two integers

#include <iostream.h> main() { // A simple C++ program int x, y, sum; cout << “A program which adds two integers\n”; cout << “Enter 1st integer: “; cin >> x; cout << “Enter 2nd integer: “; cin >> y; sum = x + y; cout << “Sum is ” << sum << endl; return 0; … Read more

Simple Program Book Entry Using structure Variable in C++ Programming

#include<iostream.h> #include<stdio.h> struct books { char name[20],author[20]; }a[50]; int main() { int i,n; cout<<“No Of Books[less than 50]:”; cin>>n; cout<<“Enter the book details\n”; cout<<”–––––––-\n”; for(i=0;i<n;i++) { cout<<“Details of Book No “<<i+1<<”\n”; cout<<“Book Name :”; cin>>a[i].name; cout<<“Book Author :”; cin>>a[i].author; cout<<”–––––––-\n”; } cout<<”================================================\n”; cout<<” S.No\t| Book Name\t|author\n”;cout<<”=====================================================”; for(i=0;i<n;i++) { cout<<”\n ”<<i+1<<”\t|”<<a[i].name<<”\t| “<<a[i].author; } cout<<”\n=================================================”; return 0; … Read more