#include<iostream.h> #include<conio.h> class bca { public: inline int sum(int x, int y) { return(x+y); } }; int main() { clrscr(); int r,a,b; bca obj; cout<<"enter two integers :"<<endl; cin>>a>>b; r=obj.sum(a,b); cout<<" the sum of two integers is :"<<r<<endl; getch(); return 0; } OUTPUT:- enter two integers : 3 6 the sum of two integer is : 9
ALGORITHM VARIABLES: § i: loop counter of array. § A: array name. § LB: lower bound. § UB: upper bound. ALGORITHM: STEP 1: set i =LB STEP 2: repeat steps 3 & 4 While i<=UB STEP 3: apply process to A[i] STEP 4: i = i+1 STEP 5: exit EXPLANATION: § To traverse the elements of the array, firstly set the loop counter ‘i’ equal to last element of the array called the LOWER BOUND. ...
Comments
Post a Comment