Codegyan has Published 17 Answers

How To Reduce the Array to 0 by decreasing elements by 1 or replacing at most K elements by 0

Updated on 14-Nov-2022 19:30:10

Given an array arr[ ] of N integers and a positive integer K, the task is to find the minimum number of operations required to reduce all array elements to 0 such that in each operation reduce any array element by 1 and independently at most K array element can be reduced to 0. Examples: Input: arr[ ] = {4, 1, 5}, K = 1 Output: 5 Explanation: Following are the operations performed to convert all array elements to 0: Here K = 1, So replace arr[2] by 0, converts arr[v] to {... Read More

How to Install Jenkins on Ubuntu

Updated on 28-Mar-2022 17:52:44

Jenkins is a software package for software developers. It’s used to automate parts of the testing, build, delivery, and deployment of software. This guide will help you install Jenkins on an Ubuntu 18.04 system. Prerequisites A system running Ubuntu 18.04 Bionic Beaver A user account with sudo privileges Access to a terminal window / command line (CTRL+ALT+T or search > terminal) Java 8 or 11 A Brief Note on Jenkins Jenkins is a CI/CD software platform tha... Read More

Write PHP Program To Check Prime Number

Updated on 16-Mar-2022 8:40:06

PHP Program To Check Prime Number : The below program checks if a number is a prime or a composite number. The PHP echo statement is used to output the result on the screen. Example <!DOCTYPE html> <html> <body>   <?php $num = 13; $count=0; for ( $i=1; $i<=$num; $i++){ if (($num%$i)==0){ $count++; } } if ($count<3){ echo "$num is a prime number."; } else{ echo "$num is not a pri... Read More

How to convert temperature from degree centigrade to Fahrenheit using C

Updated on 12-Dec-2021 9:21:47

C Program to convert temperature from degree centigrade to Fahrenheit #include <stdio.h> int main() { float celsius, fahrenheit; printf("\nEnter temp in Celsius : "); scanf("%f", &celsius); fahrenheit = (1.8 * celsius) + 32; printf("\nTemperature in Fahrenheit : %f ", fahrenheit); return (0); } Output Enter temp in Celsius : 32 Temperature in Fahrenheit : 89.59998 ... Read More

How to find area and circumference of circle using C Programming

Updated on 12-Dec-2021 9:15:04

C Program to find area and circumference of circle #include <stdio.h> int main() { int rad; float PI = 3.14, area, ci; printf("\nEnter radius of circle: "); scanf("%d", &rad); area = PI * rad * rad; printf("\nArea of circle : %f ", area); ci = 2 * PI * rad; printf("\nCircumference : %f ", ci); return (0); } Output : Enter radius of a circle : 1 Area of circle : 3.14 Circumference : 6.28 Explanation of Program : In this... Read More

How to find gretest in 3 number using C Programming

Updated on 12-Dec-2021 9:00:53

C Program to find greatest in 3 numbers #include <stdio.h> int main() { int a, b, c; printf("\nEnter value of a, b & c : "); scanf("%d %d %d", &a, &b, &c); if ((a > b) && (a > c)) printf("\na is greatest"); if ((b > c) && (b > a)) printf("\nb is greatest"); if ((c > a) && (c > b)) printf("\nc is greatest"); return(0); } Output : Enter value for a,b & c : 15 17 21 c is greatest ... Read More

How to find sum of two numbers using C Language

Updated on 12-Dec-2021 9:06:20

C program to find sum of two numbers #include <stdio.h> int main() { int a, b, sum; printf("\nEnter two no: "); scanf("%d %d", &a, &b); sum = a + b; printf("Sum : %d", sum); return(0); } Output: Enter two no: 5 6 Sum : 11 ... Read More

How To Send mail from your Gmail account using Python

Updated on 22-Nov-2021 22:09:23

Here, we are going to learn how to send a simple basic mail using Python code. Python, being a powerful language don’t need any external library to import and offers a native library to send emails- “SMTP lib”. “smtplib” creates a Simple Mail Transfer Protocol client session object which is used to send emails to any valid email id on the internet. Different websites use different port numbers. In this article, we are using a Gmail account to send a mail. Port number used here is ... Read More

Accept Credit Cards Online with an Merchant Account!

Updated on 01-Nov-2021 9:17:20

If you want to accept credit cards online, you will need to set up a credit card merchant account with a reputable firm. There are a lot of merchant account providers out there, however, Codegyan has teamed up with e-onlinedata to make it easy for our customers to obtain merchant accounts and use the Authorize.net gateway. Authorize.net will integrate into the shopping carts that we provide, such as OSCommerce, CubeCart, WHMCS, etc. The offer we’ve got for our customers is someth... Read More

How to get a list of parameter names inside Python function?

Updated on 30-Oct-2021 13:44:28

To extract the number and names of the arguments from a function or function[something] to return ("arg1", "arg2"), we use the inspect module. The given code is written as follows using inspect module to find the parameters inside the functions aMethod and foo. Example import inspect def aMethod(arg1, arg2): pass print(inspect.getargspec(aMethod)) def foo(a,b,c=4, *arglist, **keywords): pass print(inspect.getargspec(foo))  Output ArgSpec(args=['arg1', 'arg2'], varargs=None, keywo... Read More

1 2 Next
Advertisements

ads