Semester : S1 and S2
Subject : Computer Programming
Year : 2017
Term : DECEMBER
Branch : BIOTECHNOLOGY
Scheme : 2015 Full Time
Course Code : CS 100
Page:23
3. Save the file as hello.c
4. Open acommand prompt and go to the directory where you saved the file.
5. Type gcc hello.c and press enter to compile your code.
6. If there are no errors in your code the command prompt will take you to the next line and would generate
a.out executable file.
7. Now, type a.out to execute your program.
8. You will be able to see "Hello World" printed on the screen.
b) Write a C program to largest among two numbers using conditional operator
/* Write a program to find Greatest Number among two numbers using Conditional Operators */
#include
#include
main()
{
int nl,n2,big;
clrscr();
printf("\n Enter TwoNumbers”);
scanf("%d%d",&n1,&n2); big =
((n1>n2)?n1:n2);
printf("\n The Greater Number 15 %d",big); getch();
Qutput
Enter Two numbers
5
11
The Greater Number is 11
b) Write a C program to multiply two matrices using the concept of 2D arrays. (10)
#include
int
main() {
int a[10][10], b[10][10], result[10][10], 2൧, cl, 22, c2, i, Jj, مع
// Column of first matrix should be equal to column of second matrix and
printf("Error! column of first matrix not equal to row of second.\n\n");
printf ("Enter rows and column for first matrix: ");
scanf("%d %d", & 11, ௨௦1) 7
printf ("Enter rows and column for second matrix: 1) 7