Wednesday, August 28, 2019

NUMBER SERIES BASIC TESTING

/**************************************************
** written by :ANIL DURGAM
** NUMBER SERIES TESTING VER 1.0
**DATE:29-08-2019
**************************************************/



#include <stdio.h>
#include <stdlib.h>

int main()
{
    int first_num,sec_num,third_num,fourth_num,next_number;
    int first_diff,second_diff,third_diff,fourth_diff;
    printf("please enter the FOUR number after every number hit ENTER\n");
    scanf("%d%d%d%d",&first_num,&sec_num,&third_num,&fourth_num);
    printf("first number=%d,\nsecond number=%d,\nthird number=%d,\nfourth number=%d\n",first_num,sec_num,third_num,fourth_num);
    first_diff=sec_num-first_num;
    second_diff=third_num-sec_num;
    third_diff=fourth_num-third_num;
    if(first_diff==second_diff)
    {
        if(third_diff==second_diff)
        {
            next_number=first_diff+fourth_num;
            printf("next number is ==%d\n",next_number);
        }
        else
        {
            printf("third and fourth number is not matching\n");
        }
    }
    else{

        printf("number not matching\n");
    }

    return 0;
}


OUTPUT:
please enter the FOUR number after every number hit ENTER
12
24
36
48
first number=12,
second number=24,
third number=36,
fourth number=48


next number is ==60

No comments:

Post a Comment

python class topic video