Write a program in ‘C’ to check whether the given year is leap or not. Also explain the logic of the program. 8m Dec2008 The leap year formula is: A leap year is divisable by 4, but not by 100 (except if divisable by 400.) #include<stdio.h> void main(){ int year; clrscr(); printf(“Enter any year:… Read More »

Write a loop that calculate sum of the n elements of the series 5m Dec2008 Write a loop that calculate sum of the n elements of the series: 5 1+ 7 +13 +19 + 25 + ……. Write the loop in 3 different ways: (i) using while loop (ii) using do-while loop #include<stdio.h> void… Read More »

When can two matrices of order m x n and p x q be multiptied? Also write a program in ‘C’ to multiply two such matrices. 10m Dec2008 The only condition which makes matrix multiplication possible is n should be equal to p (i.e. n==p) n of m x n Matrix and p of… Read More »

1. (a) Design an algorithm, draw a corresponding flow chart and write a program in ‘C’, to find the factorial of a given number using recursion. 10m Dec2008 Flowchart: Code: #include<stdio.h> void main() { int factorial(); int FACT,NUM; clrscr(); printf(“ENTER NUMBER : “); scanf(“%d”,&NUM); if(NUM>0) { FACT=factorial(NUM); printf(“\nFACTORIAL OF GIVEN NUMBER IS %d “,FACT);… Read More »