In The Name Of Allah

Programming1-Sila Baca dan beri comment atau fahami dengan betul2. .INSYAALLAH

Sunday 10 March 2013

Continue Array, .

08/march 2013
Friday

This is array for user keep in the result of the programed. .

#include<stdio.h>

void main()
{

    int a[3];
    int b[3];
    int sumOfa=0;
    int sumOfb=0;
    int sumOfaxb=0;

    int counter;

    for(counter=0;counter<=2;counter++)
    {
        printf("Please enter your element[%d] of a :",counter);
        scanf("%d",&a[counter]);

    }

        printf("\n\n");


    for(counter=0;counter<=2;counter++)
    {
        printf("Enter your element[%d] of b :",counter);
        scanf("%d",&b[counter]);

    }

    for(counter=0;counter<=2;counter++)
    {
     sumOfa=sumOfa+a[counter];
     sumOfb=sumOfb+b[counter];
     sumOfaxb=sumOfaxb+ a[counter]*b[counter];

    }


    printf("Sum Of a elements is%d\n",sumOfa);
    printf("Sum Of b elements is%d\n",sumOfb);
    printf("Sum Of axb elements is%d\n",sumOfaxb);

    printf("Sum Of axb/ sum of a is%d\n",sumOfaxb/sumOfa);

    printf("|--------------------------------------------------------------------------|\n");
    printf("|\tThing\t|\ta\t|\tb\t|\taxb\t\t|\n");
    printf("|--------------------------------------------------------------------------|\n");

    for(counter=0;counter<=2;counter++)
    {

        printf("|\tThing %d\t|\t%d\t|\t%d\t|\t%d\t\t|\n",counter +1,a[counter],b[counter],a[counter]*b[counter]);

    }


    printf("|--------------------------------------------------------------------------|\n");
    printf("|\tTotal-total\t|\t%d\t|\t%d\t|\t%d\t\t|\n",sumOfa,sumOfb,sumOfaxb);
    printf("|--------------------------------------------------------------------------|\n");


}
 You can try it because i tried it first. .it's too hard if you dont try it. .if you try that,you can understand how to use the programed array.it esay than before it.

see this video if you don't understand how to use correctly. .repeat and repeat until you understand that. .

https://www.youtube.com/watch?v=N0CvvM-J8RY&feature=em-share_video_user

No comments:

Post a Comment