Skip to main content

Posts

Showing posts from April, 2017

Summation, Subtraction, Multiplication, Division [C Programming]

#include<stdio.h> int main() {     float a, b, c;     printf("Enter a number: ");     scanf("%f", &a);     printf("Enter another number: ");     scanf("%f", &b);     c = a + b;     printf("%0.2f + %0.2f = %0.2f\n", a, b, c);     c = a - b;     printf("%0.2f - %0.2f = %0.2f\n", a, b, c);     c = a * b;     printf("%0.2f * %0.2f = %0.2f\n", a, b, c);     c = a / b;     printf("%0.2f / %0.2f = %0.2f\n", a, b, c);     return 0; }

Program to Print Escape Characters [C Programming]

#include <stdio.h> void main( void ) {     printf("Teacher: Do you know programming\?\n"); //\? is used to print ?     printf("Student: No, I\'m not prepared.\n"); //\' is used to print '     printf("Teacher: Check D:\\Programming\\Tutorial for details.\n"); //\\ is used to print     printf("Student: Is the book \"C++ Bible\" good?\n"); //\" is used to print "     printf("Teacher: Yes, it is.\n"); }

Take an input & display it in console [Assembly Language Programming]

.MODEL SMALL .STACK 100H .DATA MSG DB 'Enter a number: $' .CODE MAIN PROC     MOV AX, @DATA       ; initialize DS     MOV DS, AX          LEA DX, MSG             ; load & display MSG     MOV AH, 9     INT 21H          MOV AH, 1                  ; takes input     INT 21H     MOV BL, AL          MOV DL, 0DH              ; display character function     MOV AH, 2                   ; carriage return     INT 21H            ...