C Programming Source Code Index



1. Write a program for performing as calculator which allows all Arithmetic Operators from terminal as input.
Note:This program allows operators('+' , '-' , '*' , '/' , '%') and operands (Variables) as input from keyboard.


2.Write a C program to find the Simple Interest. Take input for principle amount, rate of interest and time from terminal.


3. Find the highest (maximum) and lowest (minimum) grades in an array of 25 integer grades. Print the array and print the highest and lowest grades, labeled appropriately.



4. Write a C Program to fill up an Integer Array. The length of the array must take from the terminal. After fill up the array do the following operations.




Comments

  1. WAP a program to count vowels,consonants,words,sentences,alphabets by using string..
    #include
    #include
    #include
    main()
    {
    char a[100];
    int b,d,e,i,l,p,k;
    b=d=e=k=0;
    printf("Enter the string: ");
    gets(a);
    l=strlen(a);
    for(i=0;a[i]!='\0';i++)
    {
    if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u'||a[i]=='A'||a[i]=='E'||a[i]=='I'||a[i]=='O'||a[i]=='U')
    d++;
    if(a[i]==' ')
    e++;
    if(a[i]=='.'||a[i]==',')
    k++;
    }
    p=l-(d+e+k);
    b=l-e;
    printf("\n\t No of vowels=%d \n",d);
    printf("\n\t No of consonants=%d \n ",p);
    printf("\n\t No of words=%d \n ",e+1);
    printf("\n\t No of total letters=%d \n",l);
    printf("\n\t No of alphabet=%d \n",b);
    printf("\n\t No of sentance=%d \n",k);
    }

    ReplyDelete
  2. #include
    main()
    {
    int i,j,sum=0,count=0;
    printf("Enter the number:");
    for(i=200;i<=400;i++)
    {
    if(i%2==0)
    printf("%d\n",i);
    count++;
    }
    printf("the all number of count:%d",count);
    }

    ReplyDelete
  3. #include
    main()
    {
    int i,num,temp=0;
    printf("Enter the number:");
    scanf("%d",&num);
    for(i=1;i<num;i++)
    if(num%i==0)
    {
    temp=temp+i;
    printf("%d\t",i);
    }
    if(temp==num)
    {
    printf("\nIts is a perfect number.");
    }
    else
    {
    printf("\nIts is not a perfect number.");
    }
    }

    ReplyDelete
  4. Write a program to calculate factorial using function and print the output as below
    5!=120
    #include
    long factorial(int);
    int main()
    {
    int number;
    printf("Enter a number to calculate it's factorial\n");
    scanf("%d", &number);
    printf("%d! = %ld\n", number, factorial(number));
    return 0;
    }
    long factorial(int n)
    {
    int i,result=1;
    for (i= 1; i <= n; i++)
    result = result * i;
    return result;
    }

    ReplyDelete

Post a Comment