Posts

C Program to Compute Quotient and Remainder

Image
Program to Compute Quotient and Remainder #include <stdio.h> int main (){ int dividend , divisor , quotient , remainder ; printf ( "Enter dividend: " ); scanf ( "%d" , & dividend ); printf ( "Enter divisor: " ); scanf ( "%d" , & divisor ); // Computes quotient quotient = dividend / divisor ; // Computes remainder remainder = dividend % divisor ; printf ( "Quotient = %d\n" , quotient ); printf ( "Remainder = %d" , remainder ); return 0 ; } OutPut Enter dividend: 25 Enter divisor: 4 Quotient = 6 Remainder = 1

C Program to Find ASCII Value of a Character

Image
Program to Print ASCII Value #include <stdio.h> int main () { char c ; printf ( "Enter a character: " ); // Reads character input from the user scanf ( "%c" , & c ); // %d displays the integer value of a character // %c displays the actual character printf ( "ASCII value of %c = %d" , c , c ); return 0 ; } For Technical Related Posts Please Visit  http://codetherush.in   OutPut Enter a character: G ASCII value of G = 71

C Program to Multiply two Floating Point Numbers

Image
Program to Multiply Two Numbers #include <stdio.h> int main () { double firstNumber , secondNumber , productOfTwoNumbers ; printf ( "Enter two numbers: " ); // Stores two floating point numbers in variable firstNumber and secondNumber respectively scanf ( "%lf %lf" , & firstNumber , & secondNumber ); // Performs multiplication and stores the result in variable productOfTwoNumbers productOfTwoNumbers = firstNumber * secondNumber ; // Result up to 2 decimal point is displayed using %.2lf printf ( "Product = %.2lf" , productofTwoNumbers ); return 0 ; } OutPut Enter two numbers: 2.4 1.12 Product = 2.69

C Program to Add Two Integers

Image
Program to Add Two Integers #include <stdio.h> int main() {     int firstNumber, secondNumber, sumOfTwoNumbers;          printf("Enter two integers: ");     // Two integers entered by user is stored using scanf() function     scanf("%d %d", &firstNumber, &secondNumber);     // sum of two numbers in stored in variable sumOfTwoNumbers     sumOfTwoNumbers = firstNumber + secondNumber;     // Displays sum           printf("%d + %d = %d", firstNumber, secondNumber, sumOfTwoNumbers);     return 0; } OutPut Enter two integers: 12 11 12 + 11 = 23

C Program to Print an Integer (Entered by the User)

Program to print an Integer #include <stdio.h> int main() {     int number;     // printf() dislpays the formatted output      printf("Enter an integer: ");            // scanf() reads the formatted input and stores them     scanf("%d", &number);            // printf() displays the formatted output     printf("You entered: %d", number);     return 0; } OutPut Enter a integer: 25 You entered: 25 For Technical Related Posts Please Visit  http://codetherush.in

C program to display "hello world"

C program to display Hello World... #include <stdio.h> int main () { // printf() displays the string inside quotation printf ( "Hello, World!" ); return 0 ; } OutPut Hello, World!