Skip to main content

Posts

Showing posts from July, 2017

C programs QnA

Q. If sum of two integer is 14 and if one of them is 8 then find other integer. Ans: Well, this is very simple. Simply, one integer is 8 and sum of two integers is 14. So, we need to subtract the number 8 from their sum of 14 to get the second number. So, the second number is: 14 - 8 = 6 C-Program of this task Code---> #include<stdio.h> int main () { int num1 = 8 , num2 , sum = 14 ; num2 = sum - num1 ; printf ( "The second number is: %d" , num2 ); return 0 ; }

Basic float division in C language

In this C -program we will take two floats(decimal number) as input from user and print the result(division). input: Two numbers(i.e : 5.7,6.8,3.5 etc.) output: Division of the two numbers CODE----> #include<stdio.h> int main () { float a , b , div ; printf ( "Enter two numbers: " ); scanf ( "%f%f" ,& a ,& b ); div = a / b ; printf ( "The result is = %f" , div ); return 0 ; } Download the C-Program file of this Program. Don't just read, run on your pc !!! RESULT : Enter two numbers: 100 12.8 The result is = 7.812500 -------------------------------- Process exited after 5.158 seconds with return value 0 Press any key to continue . . . Images for better understanding :

Basic float multiplication in C language

In this C -program we will take two floats(decimal number) as input from user and print the result(multiplication). input: Two numbers(i.e : 5.7,6.8,3.5 etc.) output: Multiplication of the two numbers CODE----> #include<stdio.h> int main () { float a , b , mul ; printf ( "Enter two numbers: " ); scanf ( "%f%f" ,& a ,& b ); mul = a * b ; printf ( "The result is = %f" , mul ); return 0 ; } Download the C-Program file of this Program. Don't just read, run on your pc !!! RESULT : Enter two numbers: 7.8 4.5 The result is = 35.100002 -------------------------------- Process exited after 6.321 seconds with return value 0 Press any key to continue . . . Images for better understanding :

Basic float subtraction in C language

In this C -program we will take two floats(decimal number) as input from user and print the result(subtraction). input: Two numbers(i.e : 5.7,6.8,3.5 etc.) output: Subtraction of the two numbers CODE----> #include<stdio.h> int main () { float a , b , sub ; printf ( "Enter two numbers: " ); scanf ( "%f%f" ,& a ,& b ); sub = a - b ; printf ( "The result is = %f" , sub ); return 0 ; } Download the C-Program file of this Program. Don't just read, run on your pc !!! RESULT : Enter two numbers: 145.5 45.5 The result is = 100.000000 -------------------------------- Process exited after 8.129 seconds with return value 0 Press any key to continue . . . Images for better understanding : 7

Basic float addition in C language

In this C -program we will take two floats(decimal number) as input from user and print the result(sum). input: Two numbers(i.e : 5.7,6.8,3.5 etc.) output: Sum of the two numbers CODE----> #include<stdio.h> int main () { float a , b , sum ; printf ( "Enter two numbers: " ); scanf ( "%f%f" ,& a ,& b ); sum = a + b ; printf ( "The result is = %f" , sum ); return 0 ; } Download the C-Program file of this Program. Don't just read, run on your pc !!! RESULT : Enter two numbers: 14.5 16.5 The result is = 31.000000 -------------------------------- Process exited after 10.05 seconds with return value 0 Press any key to continue . . . Images for better understanding :

Basic integer division in C language

In this C -program we will take two integers(decimal number) as input from user and print the result(division). input: Two numbers. output: Division of the two numbers(integers). CODE----> #include<stdio.h> int main () { int a , b , div ; printf ( " Enter two numbers (dividend first) : " ); scanf ( "%d%d" ,& a ,& b ); div = a / b ; printf ( "\n The result is = %d" , div ); return 0 ; } Download the C-Program file of this Program. Don't just read, write it, run it..... RESULT : Enter two numbers (dividend first) : 45 5 The result is = 9 -------------------------------- Process exited after 26.88 seconds with return value 0 Press any key to continue . . . Images for better understanding :

Basic integer multiplication in C language

In this C -program we will take two integers(decimal number) as input from user and print the result(multiplication). input: Two Numbers. output: Multiplication of the two numbers(integers). CODE----> #include<stdio.h> int main () { int a , b , mul ; printf ( " Enter two numbers : " ); scanf ( "%d%d" ,& a ,& b ); mul = a * b ; printf ( "\n The result is = %d" , mul ); return 0 ; } Download the C-Program file of this Program. Don't just read, write it, run it..... RESULT : Enter two numbers : 10 7 The result is = 70 -------------------------------- Process exited after 34.79 seconds with return value 0 Press any key to continue . . . Images for better understanding :

Basic integer subtraction in C language

In this C -program we will take two integers(decimal number) as input from user and print the result(difference). input: Two Numbers(integers). output: Difference of the two numbers. CODE----> #include<stdio.h> int main () { int a , b , sub ; printf ( " Enter two numbers : " ); scanf ( "%d%d" ,& a ,& b ); sub = a - b ; printf ( " The result is = %d" , sub ); return 0 ; } Download the C-Program file of this Program. Don't just read, write it, run it..... RESULT : Enter two numbers : 1000 500 The result is = 500 -------------------------------- Process exited after 41.11 seconds with return value 0 Press any key to continue . . . Images for better understanding :

Basic Integer Addition in C language

In this C -program we will take two integers(decimal number) as input from user and print the result(sum). input: Two numbers(integers). output: Sum of the two numbers. CODE----> #include<stdio.h> int main () { int a , b , sum ; printf ( " Enter two numbers : " ); scanf ( "%d%d" ,& a ,& b ); sum = a + b ; printf ( "\n The result is = %d" , sum ); return 0 ; } Download the C-Program file of this Program. Don't just read, write it, run it..... RESULT : Enter two numbers : 45 100 The result is = 145 -------------------------------- Process exited after 31.76 seconds with return value 0 Press any key to continue . . . Images for better understanding :

"Hello world !" in c language

In this C-program we will print " Hello world !!! " on the screen. input: NULL. output: " Hello World !!! " will be printed on the screen. CODE----> #include<stdio.h> int main () { printf ( " Hello world !!! " ); return 0 ; } Download the C-Program file of this Program. Don't just read, run on your pc !!! RESULT : Hello world !!! -------------------------------- Process exited after 0.1719 seconds with return value 0 Press any key to continue . . . Images for better understanding : Also on Youtube :