Programming Articles - Page 1395 of 3363

What is the common error occurred while using scanf() statement in C language?

Bhanu Priya
Updated on 09-Mar-2021 07:14:33

1K+ Views

ProblemCommon error occurred while reading string and numeric data using scanf() function in C languageSolutionThe scanf() function is used to read formatted input from stdin in C language. It returns the whole number of characters written in it otherwise, returns a negative value.Generally in case of scanf() function while reading string values after integer from the user, we get frequent errors.ExampleFollowing is a C program which reads roll number (integer value) and name of a student − Live Demo#include struct student {    char name[10];    int roll; } s; int main(){    printf("Enter information of students:");    printf("Enter roll ... Read More

How to print a name multiple times without loop statement using C language?

Bhanu Priya
Updated on 09-Mar-2021 07:13:35

8K+ Views

ProblemTry to print a name 10 times without using any loop or goto statement in C programming language.SolutionGenerally, looping statements are used to repeat the block of code until condition is false.Example1In this program, we are trying to print a name 10 times without using loop or goto statements. Live Demo#include void printname(char* name,int count){    printf("%03d : %s",count+1,name);    count+=1;    if(count

Is it possible to give arguments in the main() function in C language?

Bhanu Priya
Updated on 09-Mar-2021 07:10:36

5K+ Views

Yes, we can give arguments in the main() function.Command line arguments in C are specified after the name of the program in the system’s command line, and these argument values are passed on to your program during program execution.The argc and argv are the two arguments that can pass to main function.But main() function is actually called by the operating system (or shell program) when you run the program from the terminal.SyntaxThe syntax is explained below −int main(int argc, char *argv[]){    //Code    return 0; }Example Live Demo#include int main(int argc, char *argv[]){    int i;    for (i = ... Read More

Find the ASCII value of the uppercase character ‘A’ using implicit conversion in C language?

Bhanu Priya
Updated on 09-Mar-2021 07:09:37

566 Views

Implicit type conversion is done by the compiler by converting smaller data type into a larger data type.For example, ASCII value of A=65.In this program, we are giving character ‘A’ as input, now write a code to convert A to 65 which is its ASCII value.ExampleFollowing is the example to find ASCII value of uppercase character ‘A’ using implicit conversion − Live Demo#include int main(){    char character = 'A';    int number = 0, value;    value = character + number; //implicit conversion    printf("The ASCII value of A is: %d", value);    return 0; }OutputThe ASCII value of ‘A’ ... Read More

What are implicit and explicit type conversions in C language?

Bhanu Priya
Updated on 12-Dec-2024 17:02:45

32K+ Views

Type conversions change an expression from one data type to another. conversions can utilize many features of type hierarchies or data representation. Implicit type conversion Explicit type conversion Implicit Type Conversion Implicit type conversions, also known as type casting or type transformation, are automatic type conversions performed by the compiler. Most programming languages have compilers that handle type transformation automatically. When operands are of different data types, the compiler automatically performs implicit type conversions by converting the smaller data type into a larger one. int i, x; float f; double ... Read More

What are the 4 steps to convert C program to Machine code?

Bhanu Priya
Updated on 09-Mar-2021 07:03:14

5K+ Views

Process of Creating and Running ProgramsA program contains a set of instructions which was written in a programming language.The programmer’s job is to write and test the program.The 4 steps to convert a ‘C’ program into machine language are &miuns;Writing and editing the programCompiling the programLinking the programExecuting the programWriting and editing the program‘Text editors’ are used to write programs.With the help of text editors, users can enter, change and store character data.All special text editors are often included with a compiler.After writing the program, the file is saved to disk.It is known as ‘source file’.This file is input to ... Read More

Python Pandas - Read data from a CSV file and print the ‘product’ column value that matches ‘Car’ for the first ten rows

Vani Nalliappan
Updated on 17-Feb-2021 06:26:32

964 Views

Assume, you have ‘products.csv’ file and the result for a number of rows and columns and ‘product’ column value matches ‘Car’ for the first ten rows are −Download the products.csv file here.Rows: 100 Columns: 8 id    product    engine    avgmileage    price    height_mm    width_mm    productionYear 1 2    Car       Diesel       21         16500       1530          1735         2020 4 5    Car         Gas        18         17450   ... Read More

How can TensorFlow be used with keras.Model to track the variables defined using sequential model?

AmitDiwan
Updated on 25-Feb-2021 15:23:15

241 Views

Tensorflow can be used to create a model that tracks internal layers by creating a sequential model and using this model to call ‘tf.zeros’ method.Read More: What is TensorFlow and how Keras work with TensorFlow to create Neural Networks?A neural network that contains at least one layer is known as a convolutional layer. We can use the Convolutional Neural Network to build learning model. The intuition behind transfer learning for image classification is, if a model is trained on a large and general dataset, this model can be used to effectively serve as a generic model for the visual world. It ... Read More

How can Tensorflow be used to compose layers using Python?

AmitDiwan
Updated on 25-Feb-2021 15:21:51

275 Views

Tensorflow can be used to compose layers by defining a class that inherits from ‘ResnetIdentityBlock’. This is used to define a block which can be used to compose the layers.Read More: What is TensorFlow and how Keras work with TensorFlow to create Neural Networks?A neural network that contains at least one layer is known as a convolutional layer. We can use the Convolutional Neural Network to build learning model. TensorFlow Hub is a repository that contains pre-trained TensorFlow models. TensorFlow can be used to fine-tune learning models. We will understand how to use models from TensorFlow Hub with tf.keras, use an ... Read More

How can Tensorflow be used to call the layer, and get the variables present in the layer?

AmitDiwan
Updated on 25-Feb-2021 15:19:33

164 Views

Tensorflow can be used to call the layer, and get the variables present in the layer, by first defining the layer, and using ‘layer.kernel’, and ‘layer.bias’ to access these variables. The ‘tf.zeros’ is used, and the layer can be iterated over and called.Read More: What is TensorFlow and how Keras work with TensorFlow to create Neural Networks?A neural network that contains at least one layer is known as a convolutional layer. We can use the Convolutional Neural Network to build learning model. The intuition behind transfer learning for image classification is, if a model is trained on a large and general ... Read More

Advertisements