Write a program to create a structure which will store name, roll and marks of 6 courses that you obtained. This structure will also store the total obtained marks. Which you can obtain by summing all the marks. Store all the data for 10 students. Print the name, roll and total obtained marks of each student.

#include<stdio.h>
#include<conio.h>
struct student
{
    char name[30];
    int roll,bangla,english,math,computer,fundamental,physics,total_m;
};
main()
{
    clrscr();
    struct student result[10];
    int i;
    for(i=0;i<10;i++)
    {
        printf("Enter Name:= ");
        scanf("%s",result[i].name);
        printf("Enter roll:= ");
        scanf("%d",&result[i].roll);
        printf("Enter Bangla Marks:= ");
        scanf("%d",&result[i].bangla);
        printf("Enter English Marks:= ");
        scanf("%d",&result[i].english);
        printf("Enter Math Marks:= ");
        scanf("%d",&result[i].math);
        printf("Enter comuter  Marks:= ");
        scanf("%d",&result[i].computer);
        printf("Enter fundamenta Marks:= ");
        scanf("%d",&result[i].fundamental);
        printf("Enter Phusics Marks:= ");
        scanf("%d",&result[i].physics);
        result[i].total_m = result[i].bangla + result[i].english + result[i].math + result[i].computer + result[i].fundamental + result[i].physics;
    }
    clrscr();
    for(i=0;i<10;i++)
    {
        printf("%s---",result[i].name);
        printf("%d---",result[i].roll);
        printf("%d\n",result[i].total_m);
    }
    getch();
}

Write a program which will input some numbers in an integer array and pass this to a function called maximum (). This function will find the maximum of the array values and returns this value to the main () function for displaying it

#include <stdio.h>
#include <conio.h>

int maximum( int [] );        

int  maximum( int values[5] )
{
    int  max_value, i;
       
    max_value = values[0];
    for( i = 0; i < 5; ++i )
        if( values[i] > max_value )
            max_value = values[i];
       
    return max_value;
}
   
main()
{
    int values[5], i, max;
   
    printf("Enter 5 numbers\n");
    for( i = 0; i < 5; ++i )
        scanf("%d", &values[i] );
       
    max = maximum( values );
    printf("\nMaximum value is %d\n", max );
    getch();
}

Write a program which will input some numbers in an integer array and pass this to a function called minimum (). This function will find the minimum of the array values and returns this value to the main () function for displaying it

#include <stdio.h>
#include<conio.h>
int minimum( int [] );        

int  minimum( int values[5] )
{
    int  min_value, i;
       
    min_value = values[0];
    for( i = 0; i < 5; ++i )
        if( values[i] < min_value )
            min_value = values[i];
       
    return min_value;
}
   
main()
{
    int values[5], i, min;
   
    printf("Enter 5 numbers\n");
    for( i = 0; i < 5; ++i )
        scanf("%d", &values[i] );
       
    min = minimum( values );
    printf("\nminimum value is %d\n", min );
    getch();
}

Write a C program to find the number of and sum of all integers greater than 50 and less than 300 that are divisible by 9 using function.

#include <stdio.h>
#include <conio.h>
int div(int n);
int main()
{
    int i,sum=0,m;
    clrscr();
    for(i=51;i<300;i++)
    {
        m=div(i);
        sum=sum+m;
    }
    printf("\n\nSum of these numbers is: %d",sum);
    getch();
}

int div(int n)
{
    if(n%9==0)
        return(n);
    else
        return(0);
}

Write a program which will read a text and count all occurrences of a particular word.

#include<stdio.h>
#include <string.h>
#include<conio.h>

void main()
{
    char a[100],b[20],c[20];
    int i,count=0,k=0,len;
    clrscr();
    printf ("\nEnter a string:-> ");
    gets(a);
    printf("\nEnter the word to be searched:-> ");
    gets(b);
    len=strlen(a);
    for(i=0;i<=len;i++)
    {
        //Assuming Space , Tab and NULL as word separator
        if(a[i]==32 || a[i]=='\t' || a[i]=='\0')
        {
            c[k]='\0';
            if(strcmp(b,c)==0)
                count++;
            k=0;
        }
        else
        {
            c[k]=a[i];
            k++;
        }
    }
    printf("Occurance of %s is = %d",b,count);
    getch();
}

Write a program to test whether the given input string is palindrome or not.

/*level, madam, radar, refer, rotator, stats */
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
    char s[20]={'\0'},a[20]={'\0'};
    int i,j,l=0;
    clrscr();
    printf("Enter String\n");
    gets(s);
    j=strlen(s)-1;
    for(i=0;i<strlen(s);i++)
        a[i]=s[j--];


    for(i=0;i<strlen(s);i++)
    {
        if (s[i]!=a[i])
        {
            printf("\n The given input is not a Palindrome");
            break;
        }
        else
        {
            l=1;
            break;
        }
    }
    if(l==1)
        printf("\n The Given Input is Palindrome");

    getch();
}

Write a c program to extract a portion of a character string and print the extracted string. Assume that m characters are extracted, starting with nth character

Write a c program to extract a portion of a character string and print the extracted string. Assume that m characters are extracted,  starting with nth character


#include<stdio.h>
#include<conio.h>
int main()
{
    char a[50],b[50];
    int s,m,i,p=0;
    printf("Please Enter String:= ");   
    gets(a);
    printf("Enter Start point for Extract:= ");
    scanf("%d",&s);
    printf("How many characters are extracted:= ");
    scanf("%d",&m);
    for(i=s;i<m+s;i++)
        b[p++]=a[i];
    b[p]='\0';
    puts(b);
    getch();
}