Definition:- OOP (Object Oriented Programming is a methodology or paradigm to design a program using classes and objects. It simplifies the software development and maintenance by providing some concepts. CLASS:- It is defined data type which defines its properties and its functions. It is the only logical representation of data. It is blue print of objects. For example:- Human beings is a class. The body part are its properties, and the actions performs by human is its function. Class does not occupy any space till an object is instantiated. Class is define by using keyword class followed by the name of class. Here, we defined a class named Room. The Variables length , breadth and height are declared inside the class are known as data members . The functions calculateArea() and calculateVolume() are known as member functions of a class. OBJECT:- It is run-time entity. It is an instance of the class. An obj...
CODE:- #include <stdio.h> int main() { int l=1189; int b=841; printf("The dimension of A0 paper= %d mm x %d mm\n",l,b); for(int i=1;i<=8;i++) { if(l>b) { l=l/2; b=b; printf("The dimension of A%d paper= %d mm x %d mm\n",i,l,b); } else { l=l; b=b/2; printf("The dimension of A%d paper= %d mm x %d mm\n",i,l,b); } } return 0; }
CODE:- #include<stdio.h> #include<conio.h> void main() { int num,i,rem; int flag=0; printf("Enter the number="); scanf("%d",&num); for(i=2;i<num;i++) { rem=num%i; if(rem==0) { flag=1; break; } else continue; } if(flag==1) printf("%d is not prime number.",num); else printf("%d is prime number.",num); }
Comments
Post a Comment