Posts

Showing posts from May, 2026

C program for Displaying 'N' Student details with Top CGPA in Tabular form (structure)

#include <stdio.h> // Structure definition struct Student {     char name[50];     int rollno;     float cgpa; }; int main() {     int n, i;     printf("Enter number of students: ");     scanf("%d", &n);     struct Student s[n]; // array of structures     // Input     for(i = 0; i < n; i++) {         printf("\nStudent %d\n", i + 1);         printf("Enter Name: ");         scanf("%s", s[i].name); // only single-word names         printf("Enter Roll No: ");         scanf("%d", &s[i].rollno);         printf("Enter CGPA: ");         scanf("%f", &s[i].cgpa);     }     // Output table     printf("\n*****************************\n");     printf("*\tName\tRollNo\tCGPA\t*\n");     printf("***********...

C program for Displaying 'N' Student details in Tabular form (structure)

#include <stdio.h> // Structure definition struct Student {     char name[50];     int rollno;     float cgpa; }; int main() {     int n, i;     printf("Enter number of students: ");     scanf("%d", &n);     struct Student s[n]; // array of structures     // Input     for(i = 0; i < n; i++) {         printf("\nStudent %d\n", i + 1);         printf("Enter Name: ");         scanf("%s", s[i].name); // only single-word names         printf("Enter Roll No: ");         scanf("%d", &s[i].rollno);         printf("Enter CGPA: ");         scanf("%f", &s[i].cgpa);     }     // Output table     printf("\n*****************************\n");     printf("*\tName\tRollNo\tCGPA\t*\n");     printf("**********...

C program for Displaying 'N' Student details in Tabular form (Structure)

#include <stdio.h> void line() {     int i;     for(i=0;i<50;i++)         printf("-"); } struct Student {     int rollNo;     char name[50];     char branch[20];     float marks; }; int main() {     int n, i;     printf("Enter number of students: ");     scanf("%d", &n);     struct Student s[n]; // Array of structures     // Input student data     for(i = 0; i < n; i++) {         printf("\nEnter details of student %d:\n", i + 1);         printf("Roll No: ");         scanf("%d", &s[i].rollNo);         printf("Name: ");         scanf(" %[^\n]", s[i].name); // reads string with spaces         printf("Branch: ");         scanf("%s", s[i].branch);         printf("Marks: "); ...

C program for 'N' number of student details (Structure)

#include <stdio.h> // Define structure struct Student {     char name[50];     char regd_no[20];     int age;     long int ph_no;     long int aadhar_no;     float cgpa;     char gender; }; int main() {     int n, i;     printf("Enter number of students: ");     scanf("%d", &n);     struct Student s[n]; // Array of structures     // Input details     for(i = 0; i < n; i++) {         printf("\nEnter details for student %d\n", i + 1);         printf("Enter Name: ");         scanf(" %s", s[i].name);         printf("Enter Registration Number: ");         scanf("%s", s[i].regd_no);         printf("Enter Age: ");         scanf("%d", &s[i].age);         printf("Enter Phone Number: "); ...

C program for Student details (Structure)

#include <stdio.h> // Define structure struct Student {     char name[50];     char regd_no[20];     int age;     long int ph_no;     long int aadhar_no;     float cgpa;     char gender; }; int main() {     struct Student s;     // Input details     printf("Enter Name: ");     scanf(" %s", s.name);     printf("Enter Registration Number: ");     scanf("%s", s.regd_no);     printf("Enter Age: ");     scanf("%d", &s.age);     printf("Enter Phone Number: ");     scanf("%ld", &s.ph_no);     printf("Enter Aadhar Number: ");     scanf("%ld", &s.aadhar_no);     printf("Enter CGPA: ");     scanf("%f", &s.cgpa);     printf("Enter Gender (M/F): ");     scanf(" %c", &s.gender);     // Display details     printf("\n--- Student D...

C program for Structure

#include <stdio.h> // Define a structure struct Student {     int roll;     char name[50];     float marks; }; int main() {     // Declare a structure variable     struct Student s1;     // Assign values     printf("Enter Roll Number: ");     scanf("%d", &s1.roll);     printf("Enter Name: ");     scanf("%s", s1.name);     printf("Enter Marks: ");     scanf("%f", &s1.marks);     // Display values     printf("\n--- Student Details ---\n");     printf("Roll Number: %d\n", s1.roll);     printf("Name: %s\n", s1.name);     printf("Marks: %.2f\n", s1.marks);     return 0; }