These are the different ways to calculate the area and circumference of the circle in C programming. #include<stdio.h>#include<conio.h>#define pi 3.14void main(){ int r; float a, c; printf(“ntenter value of radius=”); scanf(“%d”,&r); a= pi*r*r; c=2*pi*r; printf(“tArea = %.2fn”,a); printf(“tCircumference = %.2fn”,c); getch();} Output You can also perform this calculate by defining pi as float value. […]
Read MoreWrite a program to functions to passing no arguments an returning no values. #include <stdio.h>#include <conio.h>void sum (void);void main(){ sum(); getch();}void sum(void){ int add, a, b; printf(“Enter two numbers:”); scanf(“%d%d”,&a,&b); add=a+b; printf(“n the sum is %d”,add);} Output
Read MoreThis program describes how to write function passing no arguments and returning values. #include <stdio.h>#include <conio.h>int sum (void);void main(){ int c; c=sum(); printf(“n The sum of two numbers is : %d”,c); getch();}int sum(void){ int add, a, b; printf(“Enter two numbers:”); scanf(“%d%d”,&a,&b); add=a+b; return(add);} Output
Read MoreThis C program describes how to write a code for function passing arguments and returning no value. #include <stdio.h>#include <conio.h>void sum (int, int);void main(){ int a,b; printf(“enter two numbers :”); scanf(“%d%d”,&a,&b); sum(a,b); getch();}void sum(int s, int t){ int add; add = s+t; printf(“n The sum of the two numbers is : %d”, add); } Output
Read MoreWrite a c program to find the sum of the N integer numbers using the fuctions. #include <stdio.h>#include <conio.h>int sum (int number);void main(){ int n; printf(“How many number : “); scanf(“%d”, &n); printf(“sum the %d numbers is : %d “,n,sum(n)); getch();}int sum(int number){ int i, add=0; for(i=1; i<=number; i++){ add+=i; } return add;} Output
Read MoreFind prime number from 1 to 100 numbers using the function on C program. #include <stdio.h>#include <conio.h>int primenumber (int number);void main(){ int i; printf(“given numbers are prime numbers :n”); for(i =1; i<=100; i++) { if(primenumber(i)) printf(“%dt”,i); } getch();}int primenumber(int number){ int i, flag=1; for(i=2; i<=number/2; i++){ if(number%i==0) flag = 0; } return flag;} Output
Read MoreThis program describes that function passing arguments and returning value. #include <stdio.h>#include <conio.h>int sum (int, int);void main(){ int a,b,c; printf(“enter two numbers :”); scanf(“%d%d”,&a,&b); c = sum(a,b); printf(“n the sum of two numbers is : %d”, c); getch();}int sum(int s, int t){ int add; add = s+t; return (add); } Output
Read MoreThis program explains how to find factorial of the entered number using recursive function. #include <stdio.h> #include <conio.h> int factorial (int); void main() { int number; printf(“enter a numbers :”); scanf(“%d”,&number); printf(“n the factorial of the entered number %d is : %d”,number, factorial(number)); getch(); } int factorial(int number){ if (number<=1) return(1); else return(number*factorial(number-1)); } Output
Read MoreWrite a program that checks whether the number entered by the user is exactly divisible by 5 but not by 11. C Code #include <stdio.h>#include <conio.h>#include <math.h>void main(){ int number; printf(“enter number:”); scanf(“%d”, &number); if(number%5==0 && number%11!=0) printf(“%d is divisible by 5 but not by 11”, number); else printf(“condition is not satisfied”); getch();} Output
Read MoreWrite a c program to find the square root of the number. #include<stdio.h>#include<conio.h>#include<math.h>void main(){ int num; int squreroot(int num); printf(“Input Number:”); scanf(“%d”,&num); squreroot(num); getch();}int squreroot(int num){ printf(“squreroot: %f”,sqrt(num)); return 0; }
Read More