Program to find the Roots of quadratic equation.
In this program ,we will now takes input as the coefficients of quadratic equations by the user and calculate the roots of the quadratic equations in c-programming.
output:-
In this blogs, this all for basics and advance of the c-programming and a lots of questions are solved properly ,c-tutorial ,c-language etc
In this program ,we will now takes input as the coefficients of quadratic equations by the user and calculate the roots of the quadratic equations in c-programming.
output:-
In this program ,we will now takes input five numbers by the user and print the sum of all five number by using pointer in c-programming.
output-
For more c-programming:-
output:
In this program , we will now taking input as a string and calculate the length of string by using pointer.
pointer : pointer is a variables that stores address of another variables.
#include<stdio.h>
#include<conio.h>
void main()
{
char str[50];
char *i,count=0;
i=str;
printf("enter the string:-");
gets(str);
while(*i!='\0'){
count++;
i++;
}
printf("\n the length of the string is %d:-",count);
getch();
}
output:-
For more c-programming:-
For more c-programming:-
output:-
For more c-programming:-
output:-
In this program, we will now takes three number from the user and swap this three number by using pointer.
In this program we will now taking input n natural number by the user and print table of the natural number in c-programming.
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i;
int *x,*y;
x=&n,y=&i;
printf("\n enter the number:-");
scanf("%d",&n);
for(i=1;i<=10;i++){
printf("\n%d*%d=%d",*x,*y,(*x)*(*y));
}
getch();
}
output:-
In this program ,we will check which string is plaindrome or not by taking input string form the user .
For more c-programming:-
In this program , we will now taking input from the user and print all prime number between 1 to 300 numbers using for loop.
prime-number:- A number which is only divisible by 1 and itself is called prime number .
#include<stdio.h>
void main()
{
int i,n;
for(n=1;n<=300;n++){
for(i=2;i<=n-1;i++){
if(n%i==0)
break;
}
if(i==n)
printf("%d ",i);
}
return(0);
}
In this program , we will now calculate the factorial of the number by taking input from the user by using pointer in c-programming
#include<stdio.h>
#include<conio.h>
int factorial(int *, int*);
void main()
{
int fact,num;
printf("enter the number:-");
scanf("%d",&num);
factorial(&num,&fact);
printf("\n the factorial of the %d is %d",num,fact);
getch();
}
int factorial(int *n,int *f)
{
int i;
*f=1;
for(i=1;i<=*n;i++)
*f=*f*(i);
return(*f);
}
output:-
For more c-programming:-
In this program ,we will now calculate the table of any number by using pointer in c-program by taking input from the user .
output:-
In this c-program , we calculate to Find the Sum and Average of a number by Using the Pointer by taking input from the user .
output:-
Output :-
In this program ,we will now swap two number by using pointer in c-program by taking input form the user.
When we call the function, we pass the address of the variable, so this method is called “Call by Reference“.
when we ask the user to enter the values for variable a and b. We passes the address of variable a and b to the function swap().
Inside the function swap() we take a local variable i. Since address of variable a and b are passed to swap() function , we take 2 pointer variables *x and *y. Pointer variable x holds the address of a and pointer variable y holds the address of b. Using below logic we swap the values present at address a( or x ) and b( or y ).
output:-
For more c-programming:-
Popular Posts
|
Contact form |