Posts

Showing posts from January, 2025

Computer Graphics using C Examples with Output

Image
Computer Graphics with C Examples 01. Program for drawing line using DDA line drawing method. C Code /* DDA - Digital Differential Analyzer (DDA) algorithm is an incremental scan conversion method of line drawing. DDA is used for linear interpolation of variables ovar an interval between start and end point. It is used for rasterization of lines, triangles and polygons. */ // Drawing a line using DDA Algorithm #include<stdio.h> #include<conio.h> #include<graphics.h> #include<math.h> int main(){ int x1, y1, x2, y2, i; float x, y, dx, dy, length; int gd = DETECT, gm; // Initialise Graphics mode detectgraph(&gd, &gm); initgraph(&gd, &gm, "C:\\TURBOC3\\BGI"); // Step 1 : Read two end points P1(x1, y1) and P2(x2, y2) printf(" Enter First Point : "); scanf("%d%d", &x1, &y1); printf(" Enter Second Point : "); scanf("%d%d", &x2, ...

Python Programming Examples with Output

Python Programming Examples 01. Program to demonstrate different number data types in Python Python Code ''' Program to demonstrate different number data types ''' # Integers x = 5 print("x = ", x) print("The type of x", type(x)) # Floating-Point Numbers y = 40.5 print("y = ", y) print("The type of y", type(y)) # Complex Numbers z = 1+5j print("z = ", z) print("The type of z", type(z)) Copy Output x = 5 The type of x <class 'int'> y = 40.5 The type of y <class 'float'> z = (1+5j) The type of z <class 'complex'> 02. Program to perform different Arithmentic Operations on numbers Python Code ''' Program to perform different Arithmentic Operations ''' # Taking Input x = float(input("Enter First Number : ...