answersLogoWhite

0

📱

C Programming

Questions related to the C Computer Programming Language. This ranges all the way from K&R to the most recent ANSI incarnations. C has become one of the most popular languages today, and has been used to write all sorts of things for nearly all of the modern operating systems and applications. It it a good compromise between speed, power, and complexity.

9,649 Questions

Write a program in C to find the complex number of a given number?

There is no such thing; you seem to have misunderstood something.

Any real number can be regarded as a complex number with zero imaginary part, eg.: 5 = 5+0i

How do you find the LCM in C?

Problem Statement for LCM:

Enter Two digits by a user and get its LCM

Answer:

#include

#include

void main()

{

int x,y,i,j;

clrscr();

printf("Enter Two Digits");

scanf("d",&x,&y);

for(i=1;i<=x;i++)

{

for(j=1;j<=y;j++)

{

if(y*i==x*j)

{

printf("LCM is %d\n",y*i);

i=i+x;

}

}

}

getch();

}

OR

there will be another easy way to solve it...

Answer:

#include

#include

void main()

{

int x,y,i,;

clrscr();

printf("Enter Two Digits = ");

scanf("d",&x,&y);

for(i=1;i<=x*y;i++) {

if(i%x==0&&i%y==0)

{

printf(LCM is %d",i);

break;

}

}

getch();

}

Write a program to number the lines in a file?

You can number the lines in a file using a simple Python program. Here's an example:

with open('input.txt', 'r') as infile, open('output.txt', 'w') as outfile:
    for line_number, line in enumerate(infile, start=1):
        outfile.write(f"{line_number}: {line}")

This code reads from input.txt, numbers each line, and writes the numbered lines to output.txt. The enumerate function is used to keep track of the line numbers, starting from 1.

How do you write a program in C to check whether a number is a palindrome or not?

The simplest method is to reverse the digits of the original number and check to see if the reversed number is equal to the original. This is not an efficient way of doing it but, for ints or long ints, it works well enough.

void main()

{

// get the number to check

long int n;

printf("ENTER A NUMBER: ");

scanf("%ld",&n);

long int n1,mod;

// make a copy of the original number in n1

n1=n;

// store the reversal in rev

long int rev=0;

while(n>0)

{

// grab the rightmost digit of n

mod = n%10;

// shift all digits of rev left, then add in the new digit

rev = rev * 10 + mod;

// shift all digits of n to the right (removing the rightmost one)

n = n / 10;

}

// after the loop, rev will have the opposite digit ordering of n1;

// if these two values are equal, then we have a palindrome

if (n1 == rev)

printf("%ld is a palindrome\n",n1);

else

printf("%ld is not a palindrome\n",n1);

}

Alternate method:

Split the number into its digits, as on the example below: Number: 3592 1st digit: 3592%10 = 2 3592/10=359. ... 2nd digit: 359%10 = 9 etc. Store these into an integer array, then check if all digits correspond to digits at the reflected position.

Is it any valid printable ascii character can be used inan identifier?

In programming languages, identifiers are used to name variables, functions, etc. In most languages, identifiers must start with a letter (uppercase or lowercase) or an underscore, followed by letters, digits, or underscores. Therefore, not all printable ASCII characters can be used in an identifier. Symbols such as @, #, $, and % are typically not allowed in identifiers.

Write a c program to find sum and average of array elements?

/*Program in c to to find the sum and average of 1D array*/

#include<stdio.h>

#include<conio.h>

void main()

{

int a[5],i,sum;

float avg=0.0;

printf("Enter the elements of array");

for(i=0;i<5;i++)

scanf("%d" ,&a[i]);

sum=a[0]+a[1]+a[2]+a[3]+a[4];

printf("\n The sum of array is %d " ,sum);

printf("\n The average of array entered is %f ", avg);

getch();

}

The minimum number of bits required to store the hexadecimal number FF is?

To store the hexadecimal number FF, we need to convert it to binary first. FF in hexadecimal is equivalent to 1111 1111 in binary, which requires 8 bits to represent. Each hexadecimal digit corresponds to 4 bits in binary, so two hexadecimal digits (FF) require 8 bits to store.

10011 is the binary number system way of writing?

The binary number 10011 is equivalent to the decimal number 19 in the base-10 number system. In binary, each digit represents a power of 2, starting from the right with 2^0, 2^1, 2^2, and so on. Therefore, 12^4 + 02^3 + 02^2 + 12^1 + 1*2^0 = 16 + 0 + 0 + 2 + 1 = 19.

What are all of the arrays of 18?

Jasmine puts 18 hats away she puts a eq number of hats on 3 shelves

How can I find the South Node in my birth chart?

To find the South Node in your birth chart, you can look for the symbol that resembles an upside-down horseshoe. It is usually located opposite the North Node symbol. The South Node represents your past experiences and tendencies that you may need to release or move away from in this lifetime.

How do you calculate the South Node in astrology?

To calculate the South Node in astrology, you need to know the date, time, and place of birth. The South Node is the point where the Moon's orbit intersects the ecliptic plane as it moves southward. It represents past experiences and patterns to be released or transformed in this lifetime. Astrologers use an ephemeris or computer software to determine the exact position of the South Node at the time of birth.

C program to print all combinations of a 4-digit number?

#include<stdio.h>

int main()

{

int a,b,c,d;

for(a=1; a<5; a++)

{

for(b=1; b<5; b++)

{

for(c=1; c<5; c++)

{

for(d=1; d<5; d++)

{

if(!(a==b a==c a==d b==c b==d c==d))

printf("dd\n",a,b,c,d);

}

}

}

}

return 0;

}

What are the main features of a compiler in C programming language?

A compiler is a comp. Program that transforms source code written in programming language into another comp. Language.the main reason to compile a program is to create an executable program...

What is thrashing in c?

Thrashing in C refers to excessive swapping of data between RAM and virtual memory, significantly slowing down the system due to the high overhead involved in managing memory. It typically occurs when a program doesn't have enough physical memory and constantly swaps data in and out of virtual memory.

Is the face recognition system an example of biometric device?

Althogh there there are better biometric devices, face recognition is an example of biometric device because it has to recognize your face to authenticate you to a facility.

What function will read a specified number of elements from a file?

The function fread() in C can be used to read a specified number of elements from a file. It takes as arguments the pointer to the buffer, size of each element, number of elements to read, and the file pointer.

What does the chemical formula C mean?

The chemical formula C represents the element carbon. Carbon is a non-metallic element commonly found in organic compounds and plays a crucial role in the chemistry of life.

What is the function of chromatids?

Chromatids are the two identical copies of DNA that make up a replicated chromosome. They are joined at the centromere and separate during cell division, ensuring each daughter cell receives an identical set of genetic information.