Академический Документы
Профессиональный Документы
Культура Документы
#include<iostream.h> #include<conio.h> void main() { clrscr(); int a,b,c; cout<<"ENTER FIRST NUMBER = "; cin>>a; cout<<"ENTER SECOND NUMBER = "; cin>>b; c=a+b; cout<<"THE RESULT IS = "<< c; getch(); }
cout<<"FRIDAY"; cout<<"SATURDAY";
// Write a program to print sum of two numbers & assin the value to a third variable.
#include<iostream.h> #include<conio.h> void main() { clrscr(); int a,b,c,s; cout<<"Enter the values of any three numbers"; cin>>a>>b>>c; s=a+b; cout<<"The sum of the first two numbers is "<<s; c=s; cout<<"\nThe value of the new variable c is"<<c; getch(); } Output :Enter the values of any three numbers 5 4 6 The sum of the first two numbers is 9 The value of the new variable c is 9
return (1); } void main () { long number; cout << "Please type a number: "; cin >> number; cout << number << "! = " << factorial (number); getch(); }
Output: enter the number whose factorial is required 5 the factorial is 120
Output Enter the employee id Enter employee name Enter the employee id Enter employee name Enter the employee id Enter employee name Enter the employee id Enter employee name Enter the employee id Enter employee name Employee Employee Employee Employee Employee Employee Employee Employee Employee Employee ID name ID name ID name ID name ID name : : : : : : : : : :
: : : : : : : : : :
cout<<"\n enter the fourth number:-"; cin>>q; } }; class result:public sum,public sub { public: void output() { cout<<"\n the sum of 1st and 2nd is:-"<<a+b; cout<<"\n\n the subtraction of 3rd and 4rth is:-"<<p-q; } }; void main() { clrscr(); result obj; obj.enter(); obj.input(); obj.output(); getch(); }
Output: Enter the first number: 2 Enter the second number: 1 Enter the third number :5 Enter the fourth number: 4 the sum of 1st and 2nd is:-3
mat3[i][j] += mat1[i][k] * mat2[k][j]; } } } cout << "The first matrix is :\n"; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { cout << mat1[i][j] << "\t"; } cout << "\n"; } cout<<"The second matrix is :\n"; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { cout << mat2[i][j]<< "\t"; } cout << "\n"; } cout<<"Product of the matrix is :\n"; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { cout << mat3[i][j] << "\t"; } cout << "\n"; } getch();