source file name: Switch5.C #include <stdio.h> int main() { char gen; //clrscr(); printf("\n enter Valid character for gender(m,f,t):\n"); gen=getchar(); switch (gen) { case 'm': case 'M': printf("Male\n"); break; case 'f': case 'F': printf(…
Read more4) Write a C program that displays Language name depending upon a number entered using switch case default statement.
source file name: Switch4.C #include <stdio.h> int main() { int lang; //clrscr(); printf("\n enter 1 to 5 numbers for programming Languages:"); scanf("%d",&lang); switch (lang) { case 1: printf("C\n"); break; case 2: printf("C++\n"); break; case 3: …
Read more10) Write a C program that allocates memory to different sets of numbers using calloc() and realloc() functions.
source file name: Memory3.C #include <stdio.h> #include <stdlib.h> int main() { int* ptr; int n, i; // clrscr(); n = 6; printf("Enter number of elements: %d\n", n); ptr = (int*)calloc(n, sizeof(int)); if (ptr == NULL) { printf("Memory not allocated.\n"); exit…
Read more9) Write a C program that display memory allocation of input numbers using malloc(), calloc() and free().
source file name: Memory2.C #include <stdio.h> #include <stdlib.h> int main() { int *ptr, *ptr1; int n, i; clrscr(); printf("Enter number of elements:\n"); scanf("%d",&n); printf("\n memory allocted elements are %d\n ", n); ptr = (int*)malloc(n * sizeof…
Read more8) Write a C program that display and calculate the sum of n numbers by using dynamic memory allocation.
source file name: Memory1.C #include<stdio.h> #include<stdlib.h> void main() { int nos,i,sum=0; int *ptr; clrscr(); printf("Enter the number of elements : "); scanf("%d",&nos); ptr=(int *)malloc(nos*sizeof(int)); if (ptr==NULL) { printf("Memory no…
Read more9) Write a C program that displays Election Voting list using pointer to structure method.
source file name: structptr.C #include<string.h> #include <stdio.h> struct Person { char *name; char *address; int age; }; int main() { void voterlist(struct Person *ptr); int i,n; struct Person p[]={ {"Sachin Patil","Chiplun",25},{"Shetal Pawar","Latur",15}, {&qu…
Read more13) Write a C Program that prints descending order numbers 10 to 1 using recursive function main.
source file name: recurfn.C #include<stdio.h> int n=10; int main() { if(n>0) { printf("%d ",n); n--; main(); } return 0; } output: 10 9 8 7 6 5 4 3 2 1
Read moresource file name: FileCopy.C Requirement of aboutsjn.txt file exists #include<stdio.h> int main() { int n; char ch; FILE *fp1,*fp2; //clrscr(); fp1=fopen("aboutsjn.txt","r"); fp2=fopen("copy1.txt","w"); while((ch=fgetc(fp1))!=EOF) { fprintf(fp2,"%c",ch); } fcl…
Read more4)Write a C program that generate a data file containing a list of customers using structure also File store the names, city and phone numbers of each customer.
Write a program that will generate a data file containing a list of customers and their phone numbers. Use structure variables to store the names, city and phone numbers of each customer. source file name: FileStruct.C #include<stdio.h> struct customer { char name[20]; char city[10]; long phone; } ; int ma…
Read more3)Write a C program to read data from the keyboard , write it to a input file again read the same data from file and display it on screen.
source file name: Readfile.C #include<stdio.h> int main() { int n; char ch; FILE *fp; //clrscr(); fp=fopen("input.txt","w"); printf("\n enter information for file:\n "); while((ch=fgetc(stdin))!=EOF) { fprintf(fp, "%c",ch); } fclose(fp); printf("\n reads data from s…
Read more8) Write a C program that finds and display memory allocation of different types using Sizeof operator.
source file name: Sizeofop.C #include <stdio.h> struct student { int rollno;//2B char name[15]; //15B char studclass[8];//8B char city[15]; //15B }; // total=40 B int main() { int n; char city[10]; int A[20]; float F[5]; struct student s1; struct student s[5]; //clrscr(); printf("\n Memory of dif…
Read more7)Write a program that reads information of Student using Student Structure with BOD structure and print a Rank wise student list with marks.
Design a structure students to contain name, BOD and total marks obtained. Use the date structure (day.month, year) to read data for 5 students in class and display list of students in rank-wise. struct date { int d,m,y; }; struct student { int rollno; char name[10]; char studclass[10]; int result; struct date …
Read more6) Write a program that store information of 10 Cricket players using Cricket Structure and print a team wise list containing names of players with their batting rating.
Define a structure called cricket that will describe the following information player name,team name, batting rating. Using cricket , declare an array player with 10 elements and write a program to read the information about all the 10 players and print a team wise list containing names of players with their batting …
Read more5) Write a program to generate list of students using structure.The program should also display the number of students coming from a particular city .
Write a program that generates a list of students. Use structure variables to store the names ,roll-no, class and city of each student. The program should also display the number of students coming from a particular city (say:’Chiplun’). source file name: StudentList.C #include<string.h> struct student { int…
Read more4) Write a program that accept two time structures intervals and display the duration time between the two times also program test valid time interval using function.
Write a program, which contents a structure to represent time in hours(0-23), minutes(0-59) and second (0-59). The program should accept two times from user and display the duration time between the two times. source file name: timediff.C #include<stdio.h> struct time { int h,m,s; }; int main() { int valid…
Read more3) Write a program that determines number of days between Republic day and Independence day using Structure.
Using structure, write a program that determines number of days between two given dates. (e.g. the given dates represent the republic day and Independence day in an year.) struct date { int d,m,y; }; void main() { struct date d1={26,1,2021}; struct date d2={15,8,2021}; int total_days,days; int mon,jandays,augdays…
Read more7) Write a JSP program that accepts students information from html form and display student's information using beans getter and setter methods.
source file name: student.html <html> <head> <title>Student Information </title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> </head> <body> <form action="htt…
Read more6) Write a JSP that display that time data using beans getter and setter methods.
source file name: timeform.html <html> <head> <title>JSP Time Bean</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> </head> <body> <form action="http://loca…
Read more5) Write a JSP program that finds Square , Cube and Factorial value of given number using Java Beans methods.
source file name: sqcubefact.html <html> <head> <title>TODO supply a title</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> </head> <body> <form action="h…
Read more4) Write a JSP program that accepts Employee name and Basic salary , JSP calculates Gross Salary of Employee and Error page found.
Write a JSP program that accepts Employee name and Basic salary , JSP calculates Gross Salary of Employee and Error page found if Salary is less than 10000 . 1. source file name: Emp,html <html> <head> <title>Employee Salary Information </title> <meta charset="UTF-…
Read more7) Write a program to calculate the area and circumference of the circle using pointer radius variable.
source file name: Areaptr.C void main() { int rad; int *radptr; float acir,cc; //clrscr(); printf("\n enter radius of circle"); scanf("%d",&rad); radptr=&rad; acir=3.1429**radptr**radptr; cc=2*3.1429**radptr; printf("\n Area =%f and Circumference of Circle= %f ",acir,cc); getch(…
Read more6) Write a program to finds given number is Prime No. or not. The number is supplied at the command line.
source file name: Primecmd.C // command line program main method have 2 parameters void main(int a, char *b[]) { void prime(int); // prototype of function int n; //clrscr(); n=atoi(b[1]); printf("\n given no : %d ",n); prime(n); getch(); } void prime(int n) { int d=2; while(d<n) { if(n%d==0) { printf(&…
Read more5) Write a program to calculate factorial value of a number. The number is supplied at the command line.
source file name: FactCmdLine.C // This command line program have main method which uses 2 parameters void main(int a, char *b[]) { void fact(int); // prototype of function int n; //clrscr(); n=atoi(b[1]); printf("\n given no : %d ",n); //scanf("%d", &n); fact(n); getch(); } void fact(in…
Read more4) Write a program that displays each array element multiplied by 5 , by using pointer pass the entire array to function.
source file name: ArrMultiPtr.C void multiptr(int *p) { int n,res,i; for(i=1;i<=6;i++) { n=*p; res=n*5; printf(" %d ",res); p++; } } void main() { int *ptr; int i; int A[]={10,250,-50,400,100,-60}; clrscr(); printf("\n given array numbers: \n "); for(i=0;i<6;i++) printf(" %d ",A[i]…
Read more3) Write a program that will interchange two values. Use call by value and call by reference functions.
source file name: SwapPtr.C void swap1(int a, int b) // call by value function { int t=a; a=b; b=t; printf("\n inside swap1 function values are X=%d and Y=%d", a,b); } void swap2(int *a, int *b) // call by pointer function { int t=*a; *a=*b; *b=t; printf("\n inside swap2 function values are C=%d and D=…
Read more