Posts

Write a program to find the Maximum Strange Numbers Between 1 and 100000

Write a program to find the Maximum Strange Numbers Between 1 and 100000 Hints: We define "strange" numbers in the following way: All strange numbers are prime.   Every single digit prime number is strange.   A number with two or more digits is strange if, and only if, the two numbers obtained from it, by removing either its first or its last digit, are also strange. Source Code: #include<stdio.h> void main() {       int strange, i, c, n, temp, k,large=0;       printf ("Strange number between 1 to 100000: \n\t ");            for (strange=1; strange <= 100000; strange++)             {                        c=1 ;                        for (i=2; i <= strange/2; i++)                              {                                    if(strange % i = = 0)                                    {                                           c=0 ;                                           break ;                    

Find the maximum term of Fibonacci sequence whose values do not exceed four million

Find the maximum term of Fibonacci sequence whose values do not exceed four million, also find the sum of the odd-valued terms. Hints: The Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ... The next number is found by adding up the two numbers before it. The 2 is found by adding the two numbers before it (1+1) Similarly, the 3 is found by adding the two numbers before it (1+2) And the 5 is (2+3), and so on! Example: the next number in the sequence above would be 21+34 = 55 So we can write the rule: The Rule is x n = x n-1 + x n-2   where: x n is term number "n" x n-1 is the previous term (n-1) x n-2 is the term before that (n-2) Source Code in C Programming #include<stdio.h> int main( ) {       long sum=0,first=0,second=1,final=0;        printf ("\n %d ",first);        printf ("\n %d ",second);             while (second < = 4000000)          

Print at least 5 possible values

Image
Problem-1: ·          An ice cream truck visits Mr. Akhtar's neighborhood every 4 days during the summer. Unfortunately, he missed it today. When can Mr. Akhtar expect the ice cream truck to visit her neighborhood again? Print at least 5 possible values.    Problem-2: ·          During the summer months, one ice cream truck visits Adina's neighborhood every 4 days and another ice cream truck visits her neighborhood every 5 days. If both trucks visited today, when is the next time both trucks will visit on the same day? Hints: To find the Least Common Multiple of two or more whole numbers, follow this procedure: Make a list of multiples for each whole number. Continue your list until at least two multiples are common to all lists. Identify the common multiples. The Least Common Multiple (LCM) is the smallest of these common multiples Find the LCM of 12

Print and Sum of all the Multiples of 3 or 5 up to 999

Print and Sum of all the Multiples of 3 or 5 up to 999. Hints: For example, to find the multiples of 3, multiply 3 by 1, 3 by 2, 3 by 3, and so on. To find the multiples of 5, multiply 5 by 1, 5 by 2, 5 by 3, and so on. The multiples are the products of these multiplications. Some examples of multiples can be found below. In each example, the counting numbers 1 through 8 are used. However, the list of multiples for a whole number is endless. Example 1:   Find the multiples of the whole number 4. Multiplication:   4 x 1 4 x 2 4 x 3 4 x 4 4 x 5 4 x 6 4 x 7 4 x 8 Multiples of 4:   4 8 12 16 20 24 28 32 Solution:   The multiples of 4 are 4, 8, 12, 16, 20, 24, 28, 32,... Example 2:   Find the multiples of the whole number 5. Multiplication:   5 x 1 5 x 2 5 x 3