Answer to Question #159023 in Python for HIDAYAT UR REHMAN

Question #159023

Compute the cyclomatic complexity of the following sample codes: Sample Code 1:

/*

* C Program to Print Diamond Pattern

*/

#include <stdio.h>


int main()

{

int number, i, k, count = 1;


printf("Enter number of rows\n"); scanf("%d", &number);

count = number - 1;

for (k = 1; k <= number; k++)

{

for (i = 1; i <= count; i++) printf(" ");

count--;

for (i = 1; i <= 2 * k - 1; i++) printf("*");

printf("\n");

}

count = 1;

for (k = 1; k <= number - 1; k++)

{

for (i = 1; i <= count; i++) printf(" ");

count++;

for (i = 1 ; i <= 2 *(number - k)-                         1; i++) printf("*");

printf("\n");

}

return 0;

}


Sample code 2:


# Python program to # print Diamond shape


# Function to print # Diamond shape

def Diamond(rows): n = 0

for i in range(1, rows + 1): # loop to print spaces

for j in range (1, (rows - i) + 1):

print(end = " ")


# loop to print star while n != (2 * i - 1):

print("*", end = "") n = n + 1

n = 0


# line break print()


k = 1

n = 1

for i in range(1, rows): # loop to print spaces

for j in range (1, k + 1): print(end = " ")

k = k + 1


# loop to print star

while n <= (2 * (rows - i) - 1):

print("*", end = "") n = n + 1

n = 1 print()


# Driver Code

# number of rows input rows = 5 Diamond(rows)


Also, create a GUI tool for Cyclomatic complexity using any language. Run the above sample code on your tool to validate your answer.


1
Expert's answer
2021-01-27T16:37:21-0500
Dear HIDAYAT UR REHMAN, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order

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