Tuesday 17 September 2019

ONLINE EXAMINATION[c programming language]

ONLINE EXAMINATION

Program:

#include<stdio.h>
#include<conio.h>
void prn();
main()
{
int i,m=0;
long ht;
char name[20];
char f[10];
char ch[50]="STATE TRUE OR FALSE. EACH CARRIES ONE MARK.";
clrscr();
prn();
gotoxy(5,4);
printf("STUDENT NAME    : ");
scanf("%s",name);
gotoxy(5,6);
printf("HALLTICKET NUMBER : ");
scanf("%ld",&ht);
clrscr();
prn();
gotoxy(2,5);
printf("%s",ch);
gotoxy(2,6);
for(i=0;i<strlen(ch);i++)
printf("-");
printf("\n\n");
printf("1. Structure is not a data type :");
scanf("%s",&f[0]);
if(f[0]==101  ||  f[0]==70)
m++;
printf("\n");
printf(2. C program is a collection of functions:");
scanf("%s",&f[1]);
if(f[1]==116 || f[1]==80)
m++;
printf("\n");
printf("3. In an array we can accept more than one value of same type :");
scanf("%s",&f[2]);
if(f[2]==116  || f[2]==84)
m++;
printf("\n");
printf("4. String is a character array :");
scanf("%s",&f[3]);
if(f[3]==116 || f[3]==84)
m++;
printf("\n");
printf("5. Any function cannot be called from any other function :");
scanf("%s",&f[4]);
if(f[4]==102 || f[4]==70)
m++;
printf("\n");
printf("6.fflush() is a macro: ");
scanf("%s",&f[5]);
if(f[5]==102 || f[5]==70)
m++;
printf("\n");
printf("7. When the file is opened in 'a+' mode modification is possible: ");
scanf("%s",&f[6]);
if(f[6]==102 || f[6]==84)
m++;
printf("\n");
printf(8. Break is a reverse word: ");
scanf("%s",&f[7]);
if(f[7]==116 || f[7]==84)
m++;
printf("\n");
printf("9. STRCHR finds the first occurrence of a given character in a string: ");
scanf("%s",&f[8]);
if(f[8]==116 || f[8]==84)
m++;
printf("\n");
printf("10. FILE STRUCTURE CONTAINS INFORMATION ABOUT THE FILE BEING USED: ");
scanf("%s",&f[9]);
if(f[9]==116 || f[9]==84)
m++;
clrscr();
prn();
printf("\n\n");
printf("STUDENT NAME               :%s",name);
printf("\n HALL TICKET NUMBER      :%ld",ht);
printf("\nTOTAL MARKS              :%d",m);
getch();
}
void prn()
{
gotoxy(25,2);
printf("C EXAMINATION");
gotoxy(25,3);
printf("_____________");
}

Output:
                                              C EXAMINATION
STUDENT NAME                : Avinash
HALL TICKET NUMBER   : 9192001

                                              C EXAMINATION
1.Structure is not a data type:f
2. C program is a collection of functions:t
3. In an array we can accept more than one value of same type :t
4. String is a character array :t
5. Any function cannot be called from any other function :f
6.fflush() is a macro:f
7. When the file is opened in 'a+' mode modification is possible:f
8. Break is a reverse word:t
9. STRCHR finds the first occurrence of a given character in a string: t
10. FILE STRUCTURE CONTAINS INFORMATION ABOUT THE FILE BEING USED:t

                                              C EXAMINATION
STUDENT NAME                  : Avinash
HALL TICKET NUMBER     :9192001
TOTAK MARKS                     :10


                                  Best Budget Laptop For Web Developers 2019

Best Budget Laptop For Programmershttps://amzn.to/2LOr3w9
Mi Fitness Band (On Offer) -   https://amzn.to/2AxC7IF
Honor Band 4(Fitness Band)https://amzn.to/2NkLjZz

Sunday 24 February 2019

Generating Numbers in the Combination of given Numbers[c programming examples with output]

Generating Numbers in the Combination of given Numbers

Program:

#include<stdio.h>
#inclue<conio.h>
main()
{
        int t,r,range,i,j,s,d;
        int a[5],b[5];
        long n;
        clrscr();
        printf("Enter no. of numbers for combination : ");
        scanf("%d",&d);
        printf("\nENter numbers for combination : ");
        for(i=0;i<d;i++)
           scanf("%d",&a[i]);
           printf("\nEnter the range : ");
           scanf("%d",&range);
           for(i=1;i<=range;i++)
          {
               n=i;s=0;t=0;
               while(n>0)
               {
                   j=0;
                   r=n%10;
                   t++;
                   while(j<d)
                   {
                       if(r==a[j])
                       s++;
                       j++;
          }
          n=n/10;
  }
         if(s==t)
             printf("%d\t",i);
         }
  getch();
}

OutPut:

Enter no. of numbers for combination:2
Enter numbers for combination:4
8
Enter the range:500
4    8    44    48    84    88
444  448  484   488

                                        Best Budget Laptop For Web Developers 2019
Best Budget Laptop For Programmershttps://amzn.to/2LOr3w9

Friday 8 February 2019

Program To Find The Sum Of The Given n Integers Using An Array[c programming examples with output]

Write A Program To Find The Sum Of The Given n Integers Using An Array

/*Program To Find Sum Of n Integers*/
#include<stdio.h>
#include<conio.h>
main()
{
    int x[50],n,i,sum;
    clrscr();
    printf("\n How many integers??");
    scanf("%d",&n);
        /*loop to read N integers*/
         f or(i=0;i<n;i++)
   {
       printf("\n Enter the %dth value: ",i+1);
       scanf("%d",&x[i]);
   }
   sum=0;
      /*loop to find sum of all integers*/
         for(i=0;i<n;i++)
       sum=sum=sum+x[i];
       printf("\nSum of all integers=%d",sum);
       getch();
}

OutPut:
How many integers??5
Enter the 1th value: 36
Enter the 2th value: 45
Enter the 3th value: 52
Enter the 4th value: 40
Enter the 5th value: 61
Sum of all integers=234

                                                   
                                         Best Budget Laptop For Web Developers 2019
Best Budget For Programmers: https://amzn.to/32GkrqC

Friday 11 January 2019

Pattern 10 using c[c programming examples with output]

C programming examples with output

Pattern
Program

#include<stdio.h>
#include<conio.h>
void main()
{
     int i,j;
     clrscr();
     for(i=1;i<=5;i++)
     {
         for(j=1;j<=i;j++)
         {
              printf("*");
         }
              printf("\n");
     }
     getch();
}

Output

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

Best Budget Laptop For Web Developers 2019

Best Budget Laptop For Programmers: https://amzn.to/32GkrqC

Advertisement

Contact Form

Name

Email *

Message *

Translate