C Program to Make a Simple Calculator Using switch case

Simple Calculator using switch Statement #include <stdio.h> int main() { char operator; double first, second; printf(“Enter an operator (+, -, *,): “); scanf(“%c”, &operator); printf(“Enter two operands: “); scanf(“%lf %lf”, &first, &second); switch (operator) { case ‘+’: printf(“%.1lf + %.1lf = %.1lf”, first, second, first + second); break; case ‘-‘: printf(“%.1lf – %.1lf = %.1lf”, … Read more

C Program to Find the Size of int, float, double and char

Program to Find the Size of Variables #include<stdio.h> int main() { int intType; float floatType; double doubleType; char charType; // sizeof evaluates the size of a variable printf(“Size of int: %ld bytes\n”, sizeof(intType)); printf(“Size of float: %ld bytes\n”, sizeof(floatType)); printf(“Size of double: %ld bytes\n”, sizeof(doubleType)); printf(“Size of char: %ld byte\n”, sizeof(charType)); return 0; }

Drawing concentric circles – C graphics examples

c graphics program example

Drawing concentric circles – C graphics examples   #include <graphics.h> int main() { int gd = DETECT, gm; int x = 320, y = 240, radius; initgraph(&gd, &gm, “C:\\TC\\BGI”); for ( radius = 25; radius <= 125 ; radius = radius + 20) circle(x, y, radius); getch(); closegraph(); return 0; }    

c program example function and pointer

c program example function and pointer

c program example function and pointer What would be the output of the following programs: main( ) { int i = 0 ; i++ ; if ( i <= 5 ) { printf ( “\nC adds wings to your thoughts” ) ; exit( ) ; main( ) ; } }

What wound be output of the following c program of function and pointer

c program example function pointer

What wound be output of the following c program of function and pointer What would be the output of the following programs:   main( ) { int i = 5, j = 2 ; junk ( &i, &j ) ; printf ( “\n%d %d”, i, j ) ; } junk ( int *i, int *j … Read more

c program example function prototype

c program example function prototype

c program example function prototype   What would be the output of the following programs: main( ) { float area ; int radius = 1 ; area = circle ( radius ) ; printf ( “\n%f”, area ) ; } circle ( int r )

Moving car program in C++

C Programming Tutorial

Moving Car Program in C++ This program is written in C++ using graphics to create and move a car. A car is made using two rectangles and two circles which act as tyres of car. A for loop is used to move the car forward by changing the rectangle and circle coordinates and erasing the … Read more