Posts

Showing posts from June 3, 2018

C++ Program To Find Area Rectangle Using Class Function | C++ Programming

Source Code #include<iostream> using namespace std; #include<iomanip> class rectangle { float  length; float  breadth; public: void setdata (int l, int b) { length=l; breadth=b; } void showdata() { cout<<"length="<<length<<endl; cout<<"Breadth="<<breadth<<endl; } float  area() { return length*breadth; } void getdata() { cout<<"Enter length:\n"; cin>>length; cout<<"Enter breadth:\n"; cin>>breadth; setdata(length,breadth); } }; int main() { rectangle r; r.getdata(); r.showdata(); cout<<"Area="<<r.area(); } OUTPUT Enter length: 25 Enter breadth: 5 length=25 Breadth=5 Area=125

C Program To Find Floor and Celing Value | C Programming

C Program To Find Floor and Celing Value Using If and Else

C Program To Find Union Of Two Sets | C Programming

The collection of well-defined distinct objects is known as a set. The word well-defined refers to a specific property that makes it easy to identify whether the given object belongs to the set or not. The word ‘distinct’ means that the objects of a set must be all different. 

C Program To Find Intersection Of Two Sets | C Programming

C Program To Find Intersection Of Two Sets #include <stdio.h> #include <conio.h> int main () {     int a [ 10 ], b [ 10 ], m , n , i , j ;     int c [ 20 ], k = 0 , flag = 0 ;     int ch ;     printf ( "Enter the number of elements in first set: \n " );     scanf ( " %d " , & m );     printf ( "Enter the elements: \n " );     for ( i = 0 ; i < m ; i ++)     {         scanf ( " %d " , & a [ i ]);     }     printf ( " \n Element of First set: \n " );     for ( i = 0 ; i < m ; i ++)     {         printf ( " %d \t " , a [ i ]);     }     printf ( " \n Enter the number of elements in second set: \n " );     scanf ( " %d " , & n );     printf ( " \n Enter the elements:" );     for ( i = 0 ; i < n ; i ++)     {         scanf ( " %d " , & b [ i ]);     }     printf ( " \n Element of Second set: \n " );     for ( i = 0 ; i &l

C++ Program To Swap Value By Passing Reference | C Programming

C++ Program To Swap Value By Passing Reference #include <iostream> using namespace std ; #include <iomanip> int swap ( int & a , int & b ) {     int temp ;     temp = a ;     a = b ;     b = temp ;     return 0 ; } int main () {     int a , b ;     cout << "Enter the value of a and b \n " ;     cin >> a >> b ;     swap ( a , b );     cout << "The swapped value of a is " << a << endl          << "The swapped value of b is " << b ; } OUTPUT Enter the value of a and b 60 90 The swapped value of a is 90 The swapped value of b is 60

C++ Program to Calculate Simple Interest By Passing Arguments | C++ Programming

Percent means per cent (hundreds), i.e., a ratio of the parts out of 100. The symbol of percent is %. We generally count percentage of marks obtained, return on investment etc. Percentage can go beyond 100% also.