Question:
C PROGRAMMING Q!!!!!!! 13POINTS?
?
2012-02-15 23:06:59 UTC
(a) Write a simple program to find the size of different basic data types in C.

(b) Write a program in C for showing working of different logical operator in C.
Your program should guide users with proper message/menu on the console.

(c) Write a function to find the area of a triangle whose length of three sides is given.

(a) Write a C program to print the following triangle:

*
***
*****
*******
*********
************



(b) Write a C program to read the internal test marks of 25 students in a class and
show the number of students who have scored more than 50% in the test.
Make necessary assumptions.

3)

(a) What is calling by reference? How it is different from call by value?
Write a C function to swap two given numbers using call by
reference mechanism.


(b) Write a C program for addition of two 3×3 matrices.

(c) Write a C program for finding GCD of two given numbers.


4)
(a) Write C programme for followings:
i) Counting the number of words in a given string
ii) Concatenating two given strings
(2×5 =10 Marks)

(b) What is a pointer? Explain pointer arithmetic with example. Also explain use of malloc function in C programming with an example (10 Marks)


5)
(a) Explain recursion. Also write a C program for Tower of Hanoi problem with
a example of 4 disks . (10 Marks)

(b) Write a C program using structure to find students grades in a class.
Make the necessary assumptions.
Five answers:
anonymous
2012-02-16 09:17:11 UTC
2.- a) http://AlgoritmosUrgentes.com/en/c.php?f=print%20*%3Bprint%20***%3Bprint%20*****%3Bprint%20*******%3Bprint%20*********%3Bprint%20************



5.- b) http://AlgoritmosUrgentes.com/en/estructuras.php?clase=student&id=name&name=char*&age=int&grade=int&group=char
anonymous
2016-05-16 15:26:09 UTC
It seems like you're on the right track, but there are a few details you need to work on. First, srand is the function to seed the random number generator, you only use it once. The rand function returns a value in the range 0 to RAND_MAX, so you need to do something to get your generated random into the range you need, 1 - 100. See the random function I defined for this purpose. I also recommend against using scanf. It's much easier to protect yourself against bad input causing your program to misbehave if you use fgets and sscanf. See below for how I would do this. If you see something you're unfamiliar with, look it up, it's a good way to learn. #include #include #include #include #define MAX_LINE_LEN 256 #define MIN_VAL 1 #define MAX_VAL 100 int random(double rangeMin, double rangeMax); int main(int argc, char *argv[]) {    time_t t;    int count = 0, answer, guess = -1;    char line[MAX_LINE_LEN];    srand((unsigned)time(&t));    answer = random(MIN_VAL,MAX_VAL);    printf("\nGuess the number between %d and %d\n",           MIN_VAL,MAX_VAL);    while (guess != answer) {       printf("> ");       fgets(line,MAX_LINE_LEN,stdin);       if (sscanf(line,"%d",&guess) == 1) {          if (guess < answer) {             printf("too low\n");          } else if (guess > answer) {             printf("too high\n");          } else {             printf("correct!\n");          }       } else {          printf("invalid entry, try again.\n");       }       ++count;    } /* end while number not guessed */    printf("\nnumber of guesses = %d\n",count);    return 0; } int random(double rangeMin, double rangeMax) {    double maxN;    assert(rangeMin <= rangeMax);    maxN = rangeMax - rangeMin;    return (int)(((rand() / (double)RAND_MAX) * maxN) + rangeMin); }
kaushal
2012-02-17 02:32:57 UTC
u should practice this programms by urself then only u can able to develop ur programming skills, if u have any doubt then u can surely ask but whole assignment u should practice by ur self only....
Vinod
2012-02-16 06:26:36 UTC
i cant type all the answers here. no1 will waste their time.

re-ask the question which you feel is difficult for you, and i'll solve it.
Graham B
2012-02-16 00:53:18 UTC
Do your own homework!!


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...