M

@Mirdula_Sampathkumar

Length of string using pointer

C
2 years ago
#include <stdio.h> #include<string.h> int main() { char str[100]="M i a"; char *ptr; int length; int i=0; ptr=str; while(str[i]!='\0'){ length++;

Vowels using pointer

C
2 years ago
#include <stdio.h> int main() { char str[100], *ptr; int vowels=0; printf("Enter a string: \n"); scanf("%s",str); ptr=str; while(*ptr!='\0'){ if(*ptr=='a'||*ptr=='e'||*ptr=='i'||*ptr=='o'||*ptr=='u'){

Swap two characters with pointers

C
2 years ago
#include <stdio.h> int main() { char a,b,temp; char *ptr1, *ptr2; printf("Enter the values of a and b: \n"); scanf("%c %c",&a, &b); printf("Before swapping a= %c and b=%c\n",a,b);

Swap two numbers with pointers

C
2 years ago
#include<stdio.h> int main() { int a,b,temp; int *ptr1, *ptr2; printf("Enter the values of a and b: \n"); scanf("%d %d",&a, &b); printf("Before swapping a= %d and b=%d\n",a,b);

Decrement sequence

C
2 years ago
#include<stdio.h> int main() { int i,n,a=42,b=72,c=85,d=80,e=3; for(i=100;i>0;i--) { if ((i==a)||(i==b)||(i==c)||(i==d)||(i==e)) { printf("%d,",i); }

Write a C program to compute mean,median and mode of 1,2,3,4,5,5,7

C
2 years ago
#include <stdio.h> int main() { int a,b,c,d,e,f,g; float mean,median,mode; scanf("%d%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f,&g); printf("a=%d\nb=%d\nc=%d\nd=%d\ne=%d\nf=%d\ng=%d\n",a,b,c,d,e,f,g); mean=(a+b+c+d+e+f+g)/7; printf("mean=%f\n",mean); median=(d+e)/2;

Write a C program to find permutation and combination

C
2 years ago
#include <stdio.h> int main() { int n, r; printf("Enter the value of n and r: \n"); scanf("%d%d", &n,&r); if (n < 0 || r < 0 || n < r) { printf("Invalid input\n");

Write a C program to check if a number id Amstrong number

C
2 years ago
#include <stdio.h> #include <math.h> int main() { int n,i,digit=0,sum=0; printf("Enter n:\n"); scanf("%d",&n); i=n; while(i>0) { i=i/10;

Write a C program to find Fibonacci sequence (do...while)

C
2 years ago
#include <stdio.h> int main() { int n1=0,n2=1,n3,i=2,n; scanf("%d",&n); printf("Enter the value of n=%d\n",n); printf("0\n1\n"); do { n3=n1+n2;

Write a C program to find Fibonacci sequence(while loop)

C
2 years ago
#include <stdio.h> int main() { int n1=0,n2=1,n3,i=2,n; scanf("%d",&n); printf("Enter the value of n=%d\n",n); printf("n1=0\nn2=1\n"); printf("0\n1\n"); while(i<n) {

Write a C program to find Fibonacci sequence(for loop)

C
2 years ago
#include <stdio.h> int main() { int n1=0,n2=1,n3,i,n; scanf("%d",&n); printf("Enter the value of n=%d\n",n); printf("n1=0\nn2=1\n"); printf("0\n1\n"); for(i=2;i<n;i++) {

Write a C program to find the area of the circle

C
2 years ago
#include <stdio.h> #include <math.h> int main() { float r,area; scanf("%f",&r); printf("Enter the value of radius,r:\n"); printf("r=%f\n",r); area=(3.14*r*r); printf("Area of the circle=%f\n",area); return 0;

Write a C program to find the roots of quadratic equation

C
2 years ago
#include <stdio.h> #include <math.h> int main() { int a,b,c,d; int root1,root2; scanf("%d%d%d",&a,&b,&c); printf("Enter the value of a=%d\n",a); printf("Enter the value of b=%d\n",b); printf("Enter the value of c=%d\n",c); d=(b*b)-4*a*c;

TAYLER SERIES(4)

C
2 years ago
#include <stdio.h> #include <math.h> double calculateNaturalLog(double x, int n) { if (x <= -1) { printf("Error: Natural logarithm is undefined for x <= -1.\n"); return 0; } double result = 0.0;

TAYLER SERIES(3)

C
2 years ago
#include <stdio.h> #include <math.h> int main() { double x; int n; printf("Enter the value of x (in radians): \n"); scanf("%lf", &x);

Taylor series(2)

C
2 years ago
#include <stdio.h> #include <math.h> int main() { double x; int n; scanf("%lf", &x); printf("Enter the value of x (in radians): %lf\n",x); scanf("%d", &n);

TAYLOR SERIES(1)

C
2 years ago
#include <stdio.h> int main() { double x; int n; scanf("%lf", &x); printf("Enter the value of x:%lf \n",x); scanf("%d", &n); printf("Enter the number of terms (n):%d \n",n);

9th Oct [summation]

C
2 years ago
#include <stdio.h> #include <math.h> int main() { int i,n,S=0; scanf("%d",&n); printf("Enter the value of n:%d",n); for(i=1;i<=n;i++) { S=pow(i,2*n)+S;

Find the HCF and LCM of two given numbers

C
2 years ago
#include <stdio.h> int main() { int num1, num2, temp; scanf("%d %d", &num1, &num2); printf("Enter two numbers : %d %d\n", num1, num2); int a= num1; int b= num2; while(num2!=0)

W-4:20.Write a C program to print the multiplication table for a given number

C
2 years ago
#include <stdio.h> int main() { int num; printf("Enter a number: "); scanf("%d", &num); printf("Multiplication Table for %d:\n", num);