Friday 26 May 2017

Write a C program to find size of structure without using sizeof operator.

Q  : Write a C program to find size of structure without using sizeof operator.

#include<stdio.h>
#include<conio.h>
struct stu
{
     int roll;
     char name[20];
     float marks[3];
};

Write a C program to find the square root of a given quadratic equation.

Q1 : Write a C program to find the square root of a given quadratic equation.
#include <math.h>

int main()
{
    double a, b, c, determinant, root1,root2, realPart, imaginaryPart;

    printf("Enter coefficients a, b and c: ");
    scanf("%lf %lf %lf",&a, &b, &c);

    determinant = b*b-4*a*c;

Wednesday 24 May 2017

Write a C program to print given number of terms of a Fibonacci series.

Q 1 :  Write a C program to print given number of terms of a Fibonacci series.

Solution : 

#include<stdio.h>
void main()
{
    int a,b,c;
   c=1;
   a=0;

Write a C program to read a line and print it reverse using recursive function.

Q : Write a C program to read a line and print it reverse using recursive function.

Solution : 


#include<stdio.h>
#include<string.h>
#include<process.h>
void print(int len,char str[])
{
int n=len;
if(n==-1)
exit(1);