Posts

Featured post

-Write C program to find even and odd number using macro

-Write C program to find even and odd number using macro #include<stdio.h> #define number(n)((n%2==0)?1:0) int main() { int num; printf("enter any number"); scanf("%d",&num); if(number(num)) printf("number is even"); else printf("number is odd"); return 0; } ***************************Output*********************** amr@amrj-virtual-machine:~$ gccevenodd.c amr@samr-virtual-machine:~$ ./a.out enter any number 2 number is evensmj@amr-virtual-machine:~$

Write a C program to find Binary Search Program in C program( Data Structure And Algorithm)

                   Data Structure And Algorithm   Write a C program to find Binary Search Program in C program #include<stdio.h> int bserch(int a[10],int key,int lb,int ub); int main() { int i,a[10],n,key,lb,ub,mid; printf("enter the no="); scanf("%d",&n); printf("enter the element="); for(i=0;i<n;i++) { scanf("%d",&a[i]); } printf("enter the key="); scanf("%d",&key); mid=bserch(a,key,0,n-1); if(key==a[mid]) { printf("%d is found at position %d",key,mid+1); } else printf("key is not found"); } int bserch(int a[10],int key,int lb,int ub) { int mid,i,n; while(lb<=ub) { mid=(lb+ub)/2; if(key<a[mid]) { ub=mid-1; bserch(a,key,lb,ub); } else if(key>a[mid]) { lb=mid+1; bserch(a,key,lb,ub); } else if(key==a[mid]) { return mid; } } } ___________________________ _____________________________________...

Input and Output in cpp in Hacker Rank

           Input and Output in cpp in Hacker Rank Objective                                                                           H     HACKER RANK In this challenge, we're practicing reading input from stdin and printing output to stdout. In C++, you can read a single whitespace-separated token of input using cin, and print output to stdout using cout. For example, let's say we declare the following variables: string s; int n; and we want to use cin to read the input "High 5" from stdin. We can do this with the following code: cin >> s >> n; The above code reads the first word ("High") from stdin and saves it as string , then reads the second word (" ") fr...

Hotel Management System Project in C++

Hotel Management System Project in C++ Given the data for Hotel management and User: Hotel Data: Hotel Name     Room Available     Location     Rating      Price per Room H1                4               Bangalore      5           100 H2                5               Bangalore      5           200 H3                6               Mumbai         3           100 User Data: User Name         UserID             Booking Cost U1                 2...

OOSE(Object Oriented Software Engineering)OOSE(Object Oriented Software Engineering)

OOSE(Object Oriented Software Engineering OOSE(Object Oriented Software Engineering) All About MCQ of OSSE.      Object Oriented Software Engineering  1. A system is an orderly grouping of……………….linked together according to plan to achieve a specific goals. (a) Dependent components (b) Interdependent Components (c) Hybrid Components (d) both (a) and (b)  Ans: A Q2. Which of the Following Represent the Correct form of a function prototype? (a) float volume(int x,float y) (b) float volume (int x , y) (c) volume (int x,int t) (d) Float volume (int flaot) Q3. The Outcome of software Engineering is an efficient and reliable…………………. (a) System software (b) application software (c) Software Product (d) both(a) and (b) Q4. A……………….is an abstract view of the system. (a) object (b) class (c) Polymorphism (d) Model Q5. A collection of similar types of objects is Considered as…………… (...

Write a c++ program to find Maximum of Three using parameterized Constructor.

//Maximum number using parameterized constructor  #include<iostream> using namespace std; class temp { int c; public: temp(int a,int b,int c) { if(a>b && b>c) { cout<<"maximum number is :"<<a; } else if(b>c) { cout<<"maximum number is "<<b; } else { cout<<"maximum number is"<<c; } } }; int main() { int a,b,c; cout<<"Enter the value:"; cin>>a>>b>>c; temp obj(a,b,c); return 0; } Out Put ******************************************************************** Enter the value:53 2 1 maximum number is :53 -------------------------------- Process exited after 5.656 seconds with return value 0 Press any key to continue . . . ************************************************************************

Write a C progrming To Calculate & Print Arithmetic Mean and Harmonic Mean.

  Write a C progrming  To Calculate & Print Arithmetic Mean and Harmonic Mean. To Calculate & Print Arithmetic Mean and Harmonic Mean. #include<stdio.h> void main() { floata,b; floatam,hm; printf("Enter the value of a"); scanf("%f",&a); printf("Enter the value of b"); scanf("%f",&b); am=(a+b)/2; printf("arithmetic mean=%f",am); hm=2/(1/a+1/b); printf("\n"); printf("harmonic mean=%f",hm); printf("\n"); } OUTPUT :- Amr@Amr-virtual-machine: ~ $ gcc slip1a.c Amr@Amr-virtual-machine:~$ ./a.out Enter the value of a 120 Enter the value of b 20 arithmeticmean= 70.0000 harmonic mean= 34.285713

Write a C Program to accept an integer and check if it is Even or Odd.

C Program to Check Even or Odd Number 🖥️ C Program to Check Even or Odd Number Below is a simple C program that checks whether a given number is even or odd. 📜 Source Code: #include <stdio.h> void main() { int num; printf("Enter number: "); scanf("%d", &num); if (num % 2 == 0) { printf("Number is even"); } else { printf("Number is odd"); } } 🖥️ Output: amr@amr-virtual-machine:~$ gcc slip6a.c amr@amr-virtual-machine:~$ ./a.out Enter number: 12 Number is even 🔹 Explanation: The program takes an integer input from the user. It checks whether the number is divisible by 2 using the modulus (%) operator. If the remainder is 0, it prints " Number is even ", otherwise, it prints " Number is odd ". 📌 Steps to Compile and Run: Save the file as slip6a.c . Open a terminal and navigate to the file location....