Strong in C Language

Monday 14 March 2011

/* ** C program to check whether an entered year is a leap year or not ** @author: suresh ** @date: 14/02/02011*/ ** @ http://www.go4expert.com  #include<stdio.h> int main(void) {     int year;         printf("Enter the year: ");     scanf("%d",&year);     /*     **    The logic is that the year is either divisible by both     **    100 and 4 , OR its only divisible by 4 not by hundred     */     if(year%400 ==0 || (year%100 != 0 && year%4 == 0))     {         printf("Year %d is a leap year",year);     }     else     {         printf("Year %d is not a leap year",year);     }         return 0; } Ascending Order Of Given Array In C
01#include<stdio.h>
02void main()
03{
04int num[4],i;
05
06
07printf("please enter 4 numbers");
08for(i=0;i<4;i++)
09{
10scanf("%i",&num[i]);
11}
12
13
14if(num[0]<num[1] && num[0]<num[2] && num[0]<num[3])
15  {
16  printf("\n%i",num[0]);
17  }
18
19else if(num[1]<num[0] && num[1]<num[2] && num[1]<num[3])
20  {
21  printf("\n%i",num[1]);
22  }
23
24 else if(num[2]<num[0] && num[2]<num[1] && num[2]<num[3])
25  {
26  printf("\n%i",num[2]);
27   }
28
29else if(num[3]<num[0] && num[3]<num[1] && num[3]<num[2])
30  {
31  printf("\n%i",num[3]);
32  }
33




#include <stdio.h>
02 
03int main(void)
04{
05int my_array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
06int test, count;
07test=sizeof my_array / sizeof my_array[0];
08printf("Size of my array is: %d\n", test);
09 
10    for (count=test; count>=0; count--)
11    {
12        printf(" %d% ", my_array[count]);   */
13    };
14}

0 comments:

Post a Comment