NPTEL PROGRAMMING ASSIGNMENTS
Problem Solving Through Programming in C
Week-12: Program 01
Due Date of Submission 2022-04-21, 23:59 IST
Week-12: Program 02
Due Date of Submission 2022-04-21, 23:59 IST
Write a C program to print the Record of the Student Merit wise in descending order.
Here a structure variable is defined which contains student rollno, name and score
Here a structure variable is defined which contains student rollno, name and score
#include<stdio.h>
struct student
{
int rollno;
char name[20];
int score;
};
void main()
{
struct student s[20];
int i, n;
scanf("%d" ,&n);
for(i=0;i<n;i++)
{
scanf("%d", &s[i].rollno);
scanf("%s", s[i].name);
scanf("%d", &s[i].score);
}
struct student
{
int rollno;
char name[20];
int score;
};
void main()
{
struct student s[20];
int i, n;
scanf("%d" ,&n);
for(i=0;i<n;i++)
{
scanf("%d", &s[i].rollno);
scanf("%s", s[i].name);
scanf("%d", &s[i].score);
}
Week-12: Program 03
Due Date of Submission 2022-04-21, 23:59 IST
Week-12 Problem 04
Due Date of Submission 2022-04-21, 23:59 IST
Write a C program to find the sum of two 1D integer arrays ‘A’ and ‘B’ of same size and store the result in another array ‘C’, where the size of the array and the elements of the array are taken as input.
For example: In the Test case the input is given as follows 5 10 20 30 40 50 1 2 3 4 5
So the output will be displayed as
Result is
11
22
33
44
55
Write the program accordingly. Use dynamic memory allocation.
For example: In the Test case the input is given as follows 5 10 20 30 40 50 1 2 3 4 5
So the output will be displayed as
Result is
11
22
33
44
55
Write the program accordingly. Use dynamic memory allocation.
#include<stdio.h>
#include<stdlib.h>
void main()
{
int i,n;
scanf("%d", &n);