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

format type in c language

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

int main()
{
    int a=789,b=1234;
    printf("a=%3d, b=%4d", a, b);
    return 0;
}

output:
a=789,b=1234

input is
a=9,b=4;
a=  9, b=   4


"\r" carriage return in c programming language

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

int main()
{
    printf("Hello \rworld!\n");
    return 0;
}


output :
world

because of \r in the printf statement....so after \r the statements  will be executed

HM-TRLR-D-868 WITH ARDUINO COMMUNICATION



THIS is the simple connection between usb ttl  and arduino uno




python class topic video