Posts

Top 6 Programming Languages for Mobile App Development

Mobile application development industry in the last five years has multiplied in leaps and bounds, changing the way businesses function worldwide. With enterprises aligning mobile apps to their productivity in recent times, and with the rapid innovation in mobile devices across platforms, it calls for mobile app developers to write several versions of an application for many different platforms using a single language and many pieces of reusable code. Are you game for that? Once you intend to realize your mobile app idea, it's time to validate it, understand the target market, and narrow down the platform on which you ideally would like to build your mobile application. As soon as that is decided, it’s time to select a programming language, keeping in mind your business strategy to make either native, hybrid, or cross-platform apps. Choose the Right Programming Language HTML5 HTML5 is the ideal programming language if you are looking to build a Web-fronted app for mobile d

C Program to Check Prime or Armstrong Number Using User-defined Function

Image
Example to check whether an integer is a prime number or an Armstrong or both by creating two separate functions. C Program to Check Prime or Armstrong Number Using User-defined Function To understand this example, you should have the knowledge of following C programming topics: C Program to Display Prime Numbers Between Intervals Using Function In this program, two user-defined functions  checkPrimeNumber()  and  checkArmstrongNumber() are created. The  checkPrimeNumber()  returns 1 if the number entered by the user is a prime number. Similarly,  checkArmstrongNumber()  returns 1 if the number entered by the user is an Armstrong number. Example: Check Prime and Armstrong Number #include <stdio.h> #include <math.h> int checkPrimeNumber(int n); int checkArmstrongNumber(int n); int main() {     int n, flag;     printf("Enter a positive integer: ");     scanf("%d", &n);     // Check prime nu

C Program to Display Prime Numbers Between Intervals Using Function

Image
Example to print all prime numbers between two numbers (entered by the user) by making a user-defined function. Prime Numbers To understand this example, you should have the knowledge of following C programming topics: C Program to Calculate the Power of a Number C Program to Check Whether a Number is Palindrome or Not To find all prime numbers between two integers,  checkPrimeNumber()  function is created. This function  C Program to Reverse a Number Example: Prime Numbers Between Two Integers #include <stdio.h> int checkPrimeNumber(int n); int main() {     int n1, n2, i, flag;     printf("Enter two positive integers: ");     scanf("%d %d", &n1, &n2);     printf("Prime numbers between %d and %d are: ", n1, n2);     for(i=n1+1; i<n2; ++i)     {         // i is a prime number, flag will be equal to 1         flag = checkPrimeNumber(i);         if(flag == 1)             printf("%d ",i);    

C Program to Reverse a Number

Example to reverse an integer entered by the user. This problem is solved using while loop in this example. To understand this example, you should have the knowledge of following C programming topics: C Programming Operators C Programming while and do...while Loop Example: Reverse an Integer #include <stdio.h> int main () { int n , reversedNumber = 0 , remainder ; printf ( "Enter an integer: " ); scanf ( "%d" , & n ); while ( n != 0 ) { remainder = n % 10 ; reversedNumber = reversedNumber * 10 + remainder ; n /= 10 ; } printf ( "Reversed Number = %d" , reversedNumber ); return 0 ; } Output Enter an integer: 2345 Reversed Number = 5432 This program takes an integer input from the user. Then the while loop is used until  n != 0 is false. Read -  Programming language In each iteration of while loop, the remainder when 

C Program to Calculate the Power of a Number

Example on how to calculate the power of a number if the exponent is an integer. Also, you will learn to compute the power using pow() function. To understand this example, you should have the knowledge of following C programming topics: C Programming Operators C Programming while and do...while Loop The program below takes two integers from the user (a base number and an exponent) and calculates the power. Read -  Programming language For example:  In case of 2 3 2 is the base number 3 is the exponent And, the power is equal to 2*2*2 Example #1: Power of a Number Using while Loop #include <stdio.h> int main () { int base , exponent ; long long result = 1 ; printf ( "Enter a base number: " ); scanf ( "%d" , & base ); printf ( "Enter an exponent: " ); scanf ( "%d" , & exponent ); while ( exponent != 0 ) { result *= base ; -

C Program to Check Whether a Number is Palindrome or Not

This program reverses an integer (entered by the user) using while loop. Then, if statement is used to check whether the reversed number is equal to the original number or not. To understand this example, you should have the knowledge of following C programming topics: C Programming Operators C if, if...else and Nested if...else Statement C Programming while and do...while Loop An integer is a palindrome if the reverse of that number is equal to the original number. Read -  Programming language Example: Program to Check Palindrome #include <stdio.h> int main () { int n , reversedInteger = 0 , remainder , originalInteger ; printf ( "Enter an integer: " ); scanf ( "%d" , & n ); originalInteger = n ; // reversed integer is stored in variable while ( n != 0 ) { remainder = n % 10 ; reversedInteger = reversedInteger * 10 + remainder ; n /= 10 ;

C Program to Check Whether a Number is Prime or Not

Example to check whether an integer (entered by the user) is a prime number or not using for loop and if...else statement. To understand this example, you should have the knowledge of following C programming topics: C if, if...else and Nested if...else Statement C Programming for Loop C Programming break and continue Statement A prime number is a positive integer which is divisible only by 1 and itself. For example: 2, 3, 5, 7, 11, 13 Read -  Programming language Example: Program to Check Prime Number #include <stdio.h> int main () { int n , i , flag = 0 ; printf ( "Enter a positive integer: " ); scanf ( "%d" ,& n ); for ( i = 2 ; i <= n / 2 ; ++ i ) { // condition for nonprime number if ( n % i == 0 ) { flag = 1 ; break ; } } if ( flag == 0 ) printf ( "%d is a prime number." , n ); else