C-Programming

Geeks for Geeks Sudo placement: Immediate Smaller Element in array in C language

The code below is Geeks for Geeks Sudo placement challenge for checking immediate smaller Element in an array and printing the desired output. Geeks for Geeks challenge(Sudo Placement): Given an integer array, for each element in the array check whether there exists a smaller element on the next immediate position of the array. If it exists print the

Advertisements
C-Programming

A program using single subscribed variable to evaluate the expression in C language

The following C program is used to evaluate the following expression: Total = Σ i=110  Xi2 where  X1, X2 … X10 they are user inputs. The code has been tested in Dev c++. CODE: #include<stdio.h> void main(){ int i; float x[10],value,total; printf(“Enter 10 REAL Numbers”); for(i=0;i<10;i++){ scanf(“%f”,&value); x[i]=value; } total=0.0; for(i=0;i<10;i++){ total = total +x[i]*x[i]; printf(“\n”);

Advertisements
Advertisements
C-Programming

Program to evaluate Graph equation y=x^n using C Language

This is the program to evaluate graph equation y=xn. This code works with non negative integers. The following code has been written and compiled in Dev c++. Code: #include<stdio.h> void main(){ int count,n; float x,y; printf(“enter the value of X and N \n”); scanf(“%f%d”,&x,&n); y=1.0; count=1; while(count<=n){ y=y*x; count++; } printf(“\nX = %.3f, N =

Advertisements
Advertisements
Advertisements
Advertisements
Advertisements
Advertisements
C-Programming

Program to display sum of series 1+1/2+1/3+…+1/n in C language

The following C program is to find the sum of the series 1+1/2+1/3+…+1/n. The following code have been compiled and executed in Dev C++. Information about the code:  > The variable is taken as double here. Int datatype will not be used here or else the generated output will be wrong. > %.3lf prints 3

%d bloggers like this: