Answer to Question #267776 in C for Tania Akter

Question #267776

1. How to declare array in c? Briefly explain the different types of array with simple example.

2. What is the process to create increment and decrement statement in C? Describe the difference between = and == symbols in C programming? Describe the header file and its usage in C programming?


3. Write a program in C to display the cube of the number up to given an integer. Go to the editor

Test Data :

Input number of terms : 5

Expected Output :

Number is : 1 and cube of the 1 is :1

Number is : 2 and cube of the 2 is :8

Number is : 3 and cube of the 3 is :27

Number is : 4 and cube of the 4 is :64

Number is : 5 and cube of the 5 is :125


4. Write a program in C to display the multiplication table of a given integer. Go to the editor

Test Data :

Input the number (Table to be calculated) : 15

Expected Output :

15 X 1 = 15

...

...

15 X 10 = 150


1
Expert's answer
2021-11-17T17:30:46-0500

1..

An array is declared using the following syntax:

datatype array_name[[array_size];

for example

int arr[5];


Types of array

Single dimensional array

for example

int arr[5];

Multidimensional array

for example

int arr[5][8];


2..

increment is created using ++

for example i++

decrement is created using --

for example i--

= is used to assign a value in the right to a value on the left.

== is used to compare two values


3..



#include <stdio.h>
#include <math.h>
int main()
{
    int n;
    printf("\nInput number of terms: ");
    scanf("%d",&n);
    
    for(int i=1;i<=n;i++){
        printf("\nNumber is : %d and cube of the %d is :%f",i,i,pow(i,3));
    }


    return 0;
}


4..



#include <stdio.h>
int main()
{
    int n;
    printf("\nInput the number (Table to be calculated): ");
    scanf("%d",&n);
    
    for(int i=1;i<=10;i++){
        printf("\n%d x %d = %d",n,i,(n*i));
    }


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS