outp

My Cart

Write program in C, for the following :a) To find the sum of digits i

Question


Write program in C, for the following : 
a) To find the sum of digits in an N digit number entered by the user, and print weather the final sum of digits is even or odd
b) To replicate strcpy() function of string.h header file
c) To convert decimal number enetered by the user into its equivalent Binary number.
d) To find the Largest and Smallest number in an unsorted array of integers, entered by the user.
e) To find count vowels and consonants present in any sentence entered by the user


Posted on : 2023-11-30 23:50:31 | Author : IGNOU Academy | View : 31

Click Here to Order on WhatsApp

Login or SignUp to View Answer / Comment or Ask Question.. Its Free

Word Count : 1259

a) Sum of Digits and Odd/Even Check in C:

```c
#include <stdio.h>

int main() {
    int n, sum = 0, digit;
    printf("Enter a number: ");
    scanf("%d", &n);
    
    // Calculating sum of digits
    while (n > 0) {
        digit = n % 10;
        sum += digit;
        n /= 10;
    }
    
    printf("Sum of digits: %d\n", sum);
    
    // Check if sum is even or odd
    if (sum % 2 == 0) {
        printf("The sum is even.\n");
    } else {
        printf("The sum is odd.\n");
    }
    
    return 0;
}
```

b) Replicating `strcpy()` Function in C:

```c
#include <stdio.h>

void myStrcpy(char *dest, const char *src) {
    while (*src != '\0') {
        *dest = *src;
        dest++;
        src++;
    }
    *dest = '\0'; // Null-terminate the destination string
}

int main() {
    char source[100], destination[100];
    printf("Enter a string: ");
    scanf("%s", source);
    
    myStrcpy(destination, source);
    
    printf("Copied string: %s\n", destination);
    
    return 0;
}
```

c) Convert Decimal to Binary in C:

```c
#include <stdio.h>

void decimalToBinary(int n) {
    int binary[32], i = 0;
    
    while (n > 0) {
        binary[i] _____ ______ _____________ _______ ______ ______ ____________ _____________.
____________ ___________ ____ __ __ _________ ____ ____ _________ ___________ __ ________ _______.
____ _________ ______ ___ ______ ______ ___ ___________ __________ _________ ___________ _________ __________ ___ _________.
____ _______ _____ __ __ _____________ _____ ______ _________.
_______ _________ ___________ _________ ________ _____ ______.
__ _____________ __________ ___ ________ _______ ___ _____________ __________ _________ ___________ _________ _______ ____________.
____________ _______ ___ ____ _____________ __ ____ ___________ ___________ ______.
____ ___________ __ _____________ _________ ____ _________ _______ _____________ ___ ____ _____________ _____ ____________ __________.
________ _____________ _____ _____________ ____________ ____ _____________ __ _________ ________ ________ ___ __________ ___________ _______.
_____ _____________ ___________ _________ ______ _____ ___________.
_____________ ___________ __ ___________ __________ __________ ___________ ___ _____ ___ _________ __ ___________ __________.
_____ ___ ___________ _______ _____________ _____________ ______ __________ ____.
______ _____ ___________ ____ _________ ___.
_______ _________ _____________ __________ ____________ __________ _________ _____ ______ _______ ____ _________.
__ ________ __ __________ ____ __ ____ ________.
_______ _______ ____________ _____ ________ ___ _________ _____________ ____ ___________ ____________.
_____________ ____________ ________ _____ ___________ __.
___________ ____ _______ ____________ ______ _______.
_______ _______ _____________ __ __________ _______.
______ _________ ___ ____________ _____ _________ ____ __________ _________ ________ ___.
____________ ______ ______ ________ _________ _________ _______ _________ __________ ___________ _____ _____ _________ _____________ _____.
____________ ________ ______ ___ ______ _____________ ___ ___________ ___________ _______.
_________ ____ ________ ____________ __ ________ ____________ ___________ ______ ___ ___ ________ _______.
____________ ______ __________ _______ ________ ___ _____________ ______ ____ _______ ____.
___________ ____ __________ ____ _______ _____ ______ _______ ____ _____ ____ __________ __ ______.
_____ __ ____ ___________ _________ ___________ _________ _____________ _____________ _________ _____________ _______ ______.
__ ___ ____________ ___ ____ ___ ____________ ___________ ___ _____________ __.
____ __________ ___________ __________ _______ ___ _________ _______ __________ _____________ ________ _____ _____________.
___________ _______ _______ ________ ___________ _____________ _____ __________ ____________ __________ __________ __ ______.
___ _________ _________ _____________ ____________ __________ ______ ___________.
____________ _______ _____ _____ ________ __ __ _____ _____ _____.
______ _______ ___ __ ______ ________.
____________ _______ _________ _____ _____ ____________ ________ ________ __________ ___ ___ ___ _____.
__________ ________ ________ _________ ____ _________ __________ _______ __ ___________.
_______ ___________ ____________ ___________ __ ___ ______ _________ ________ _____ _________ ____ __________ ___.
_________ ____________ ___________ ___ _________ ____ ____.
_____ _______ ________ ________ ___ ___________ __ ___________ __________ __________ ____ ____________ ____ _________ __________.
____ ________ _____________ __________ ___ __________ ______ __ __ ______ _________.
_____ _____ ______ ____ ______ ____________ ________ ____________.
__ __ __________ _________ _______ ___________ ___________.
________ ______ ___________ ___________ ____________ _____ ______ __ _______ ____ ________ ___________ ___________.
___ ______ ______ _____ __ ____________ _______ _________ ________ ___________ ___________ ___________ __.
________ _____ ____ _____________ ____________ ______ ___________ ____________ _______ __.
__________ _______ _________ ________ ___ ____ __________ _____ _______ _______ _______ ____ _______ ___________ _______.
_____ _________ ________ __________ _____________ _____ _____________ _________ ___ __ _________ ___.
________ ____ _______ ______ ________ ________ _________ ________ ____________ ___________ ____________ ________ __________ __ ______.
____ ___________ ___________ _________ __ ____ ______ __ ___ __ ___________ _______ _________ ________.
______ _________ _________ ______ ________ _______.
_______ ________ ___ ____________ _______ ___ ____ ___ _____ _____________ ____________ ____________.
_______ ___ ___ ___ _____________ __________ _____________ __ __________ ___________ __________ ___ ______ ____________ _______.
______ _____ _____ _______ _________ _______ _____________ ________ ___________ __________ _________ ____ ____________ ____________.
_______ _____ __ ______ ____________ ______ _____ ______ _______ _________ _______.
___ ____ ___ _________ _______ ______ _________ __ _________ _______ _________.
______ _____ __ _____________ __ ________ __________ ____________ ____________ __ ________ ______ ____.
_______ ___ _________ _________ __ _____ ________ _____________ ___.
____________ _______ __ ______ __ ___ ______.
_________ _____________ ____ _____________ ________ _____.
____________ ____________ _____ __ ______ _________ __________ ____________.
_____ __ ___________ _____ ________ _____ ________ _____ _______ _____ _________ ____ __________.
____ __ _________ ________ _________ ____ ___ __ _____________ ____________ ______ ______ ______.
________ _________ ____ ________ ___________ ___ ___________ _____________ __________ ________ _____________ __________.
__ __ ____ _______ ______ ____________ __ ______ _____ ____________ ____ __________ ___________.
________ ____________ ________ ______ _________ _______ ___________ ____________ ___________ _____________ ____ ________ __.
_______ ___________ ______ ____________ ___ __ ___ ___________ _____________ _______ __________ ______.
__ __________ ____________ ____ _______ ______ ___________ __ __ _______ ___ ________ ____ _______ __________.
______ ______ _____________ ___________ ___________ _________.
_______ ___ ___________ ____________ ____ __ _____ _______ _____________.
______ ___________ ____ _____________ ________ _________ ___ ________ ________ __________ _____________ __________.
________ _______ ___________ ___ _________ ___________ _______ ____________ __________ __ __________ _____________ _____ ______ ______.
_____ ____ ________ _______ _______ ____ ____________ __.
_______ ___ ___________ _____ ______ _____ _____________ ____________.
___________ ___ ______ ___________ ____________ _________ _____ _____________ ___________ ____________ _____ _________ __________ ___ _____.
____ _____ _______ __________ _____________ ___ ___________ _____ _____________ _________ _____ _____________ _________ ______.
___________ ___________ _________ __ _____________ ___ ____ ____________ ____________ ____________ __ ______ _____________ _________ ______.
__ ___ __________ ____________ _________ _______ __________ ____________ ___________ ___ __________ ________.
________ ______ ___________ ______ ________ ________ ___ ____ ___________ ___ ____________ __ __ ___.
____________ ______ ____ ____ ____ _____________ ______ ___________ _____ _______ _________ __________ __.
___ _____________ __ _____________ __________ ____ ______ ______ _____________ _____________ _____ _________ ________ __________.
__________ _________ _______ __ ____________ _________ __ _____________ _______ ____ _____________ ___ ____________.
____ _____ ____________ _________ _____ _____ ____ ______ _________.
____ ______ ___ _______ _____________ ___ __________ _________ ______ ___________ ____ ____________.
____________ _____ ________ _____ _____ ____ ___________ ________ __ ____ ____ ____________ _____.
___ __ _____________ ___ ___________ _____________ __.
____ __ _________ ____ _____________ ______ ______ ________ _________ _____ __ ________ _________.
________ _____ _____________ ___.
Click Here to Order Full Assignment on WhatsApp








Degree : PG DIPLOMA PROGRAMMES
Course Name : POST GRADUATE DIPLOMA IN COMPUTER APPLICATIONS
Course Code : PGDCA_NEW
Subject Name : C and PYTHON Lab
Subject Code : MCSL 205
Year : 2023



IGNOU MCSL 205 Solved Assignment 2023
Click Here to Order on WhatsApp

Related Question


Using Structures write an interactive program in C language to create an application
program for a small school to maintain the Student_’s database. This application should
be having menu options like (10 Marks)
• Creating a New Record
• Reading/Listing of Records
• Modify the record
•Delete the record 

Each Student_ record should have Student_Name, Student_Roll_No., Student_Class, Student_Fees, Date of Admission, etc.). The application should be designed user-friendly.


Write program in C, for the following : 
a) To find the sum of digits in an N digit number entered by the user, and print weather the final sum of digits is even or odd
b) To replicate strcpy() function of string.h header file
c) To convert decimal number enetered by the user into its equivalent Binary number.
d) To find the Largest and Smallest number in an unsorted array of integers, entered by the user.
e) To find count vowels and consonants present in any sentence entered by the user


Write Program to perform following tasks (10 Marks)
a. Create a database PRODUCT_SELECTION_DB
b. Set connection with mysql.connector.connect.

c. Create a table PRODUCT _SELECTION in database PRODUCT_SELECTION_DB with
following data PRODUCT_NAME,PRODUCT_PRICE, MANUFACTURER, EXPIRY_DATE.
d. change table structure / (add, edit, remove column of a table) at run time
i. add a column address in the PRODUCT_SELECTION table.
ii. execute SQL INSERT statement to create a record into PRODUCT _SELECTION table
iii. run the query to updates all the records having EXPIRY_DATE as 31-Dec-2022 and
increase PRICE of all the PRODUCTS by 10% of PRODUCT_PRICE.
iv. delete all the records from PRODUCT _SELECTION Table where EXPIRY_DATE is
before 31-Dec-2022.


Download any Dataset, then write a python code to read the downloaded dataset of your choice (April be CSV file) and print all features i.e. columns of the dataset. Determine the descriptive statistics i.e. Mean Median, Maximum, Minimum ,Range, Count, Variance, Standard Deviation etc. of the numeric features like age, marks, income etc., which April be present in the dataset.

Call Now
Contact Us
Welcome to IGNOU Academy

Click to Contact Us

Call - 9199852182 Call - 9852900088 myabhasolutions@gmail.com WhatsApp - 9852900088
New to IGNOU Login to Get Every Update